Problem: We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.  The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet.  Determine whether we will have a bingo when the N numbers are chosen, that is, the sheet will contain three marked numbers in a row, column, or diagonal.

Submission attempts (in order):
A = []
A.append(input().split())
A.append(input().split())
A.append(input().split())
N = int(input())
b = [input() for _ in range(N)]
 
for i in range(N):
  for j in range(3):
    if b[i] in A[j]: A[j][A[j].index(b[i])] = True
    
if (A[0] and A[3] and A[6]) or (A[1] and A[4] and A[7]) or (A[2] and A[5] and A[8]) or (A[0] and A[1] and A[2]) or (A[3] and A[4] and A[5]) or (A[6] and A[7] and A[8]) or (A[0] and A[4] and A[8]) or (A[2] and A[4] and A[6]): print('Yes')

A = []
A.append(input().split())
A.append(input().split())
A.append(input().split())
N = int(input())
b = [input() for _ in range(N)]
 
for i in range(N):
  for j in range(3):
    if b[i] in A[j]: A[j][A[j].index(b[i])] = True
    
if (A[0] and A[3] and A[6]) or (A[1] and A[4] and A[7]) or (A[2] and A[5] and A[8]) or (A[0] and A[1] and A[2]) or (A[3] and A[4] and A[5]) or (A[6] and A[7] and A[8]) or (A[0] and A[4] and A[8]) or (A[2] and A[4] and A[6]): print('Yes')
else: print('No')

A.append(input().split())
A.append(input().split())
A.append(input().split())
N = int(input())
b = [input() for _ in range(N)]


for i in range(N):
  for j in range(3):
    if b[i] in A[j]: A[j][A[j].index(b[i])] = True
    
if (A[0][0] and A[1][0] and A[2][0]) or (A[0][1] and A[1][1] and A[2][1]) or (A[0][2] and A[1][2] and A[2][2]) or (A[0][0] and A[0][1] and A[0][2]) or (A[1][0] and A[1][1] and A[1][2]) or (A[2][0] and A[2][1] and A[2][2]) or (A[0][0] and A[1][1] and A[2][2]) or (A[0][2] and A[1][1] and A[2][0]): print('Yes')
else: print('No')

A = []
A += input().split()
A += input().split()
A+= input().split()
N = int(input())
b = [input() for _ in range(N)]

for i in range(N):
  if b[i] in A:
    A[A.index(b[i])] = '.'
    
if (A[0] == '.' and A[3] == '.' and A[6] == '.') or (A[1] == '.' and A[4] == '.' and A[7] == '.')
or (A[2] == '.' and A[5] == '.' and A[8] == '.') or (A[0] == '.' and A[1] == '.' and A[2] == '.')
or (A[3] == '.' and A[4] == '.' and A[5] == '.') or (A[6] == '.' and A[7] == '.' and A[8] == '.')
or (A[0] == '.' and A[4] == '.' and A[8] == '.') or (A[2] == '.' and A[4] == '.' and A[6] == '.'):
  print('Yes')
else: print('No')

A = []
A.append(input().split())
A.append(input().split())
A.append(input().split())
N = int(input())
b = [input() for _ in range(N)]
 

for i in range(N):
  for j in range(3):
    if b[i] in A[j]: A[j][A[j].index(b[i])] = True

if (A[0][0]==True and A[1][0]==True and A[2][0]==True) or (A[0][1]==True and A[1][1]==True and A[2][1]==True) or (A[0][2]==True and A[1][2]==True and A[2][2]==True) or (A[0][0]==True and A[0][1]==True and A[0][2]==True) or (A[1][0]==True and A[1][1]==True and A[1][2]==True) or (A[2][0]==True and A[2][1]==True and A[2][2]==True) or (A[0][0]==True and A[1][1]==True and A[2][2]==True) or (A[0][2]==True and A[1][1]==True and A[2][0]==True): print('Yes')
else: print('No')

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted