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 = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = []
for _ in range(N):
    B.append(input())
    
for b in B:
    for x in range(3):
        for y in range(3) :
            if A[x][y] == b:
                A[x][y] = 0
if A[0][0] + A[1][0] + A[2][0] == 0 \
or A[0][1] + A[1][1] + A[2][1] == 0 \
or A[0][2] + A[1][2] + A[2][2] == 0 \
or A[0][0] + A[0][1] + A[0][2] == 0 \
or A[1][0] + A[1][1] + A[1][2] == 0 \
or A[2][0] + A[2][1] + A[2][2] == 0 \
or A[0][0] + A[1][1] + A[2][2] == 0 \
or A[0][2] + A[1][1] + A[2][0] == 0:
    print("Yes")
else:
    print("No") 


A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = []
for _ in range(n):
    B.append(input())

for b in B:
    for x in range(3):
        for y in range(3) :
            if a[x][y] == b:
                a[x][y] = 0

if A[0][0] * A[1][0] * A[2][0] == 0 or A[0][1] * A[1][1] * A[2][1] == 0 or A[0][2] * A[1][2] * A[2][2] == 0 or A[0][0] * A[0][1] * A[0][2] == 0 or A[1][0] * A[1][1] * A[1][2] == 0 or A[2][0] * A[2][1] * A[2][2] == 0 or A[0][0] * A[1][1] * A[2][2] == 0 or A[0][2] * A[1][1] * A[2][0] == 0:
    print("Yes")
else:
    print("No") 


A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = []
for _ in range(N):
    B.append(input())
for b in B:
    for x in range(3):
        for y in range(3) :
            if A[x][y] == b:
                A[x][y] = 0
if A[0][0] * A[1][0] * A[2][0] == 0 \
or A[0][1] * A[1][1] * A[2][1] == 0 \
or A[0][2] * A[1][2] * A[2][2] == 0 \
or A[0][0] * A[0][1] * A[0][2] == 0 \
or A[1][0] * A[1][1] * A[1][2] == 0 \
or A[2][0] * A[2][1] * A[2][2] == 0 \
or A[0][0] * A[1][1] * A[2][2] == 0 \
or A[0][2] * A[1][1] * A[2][0] == 0:
    print("Yes")
else:
    print("No") 


[a11, a12, a13],[a21, a22, a23],[a31, a32, a33] = [input().split() for l in range(3)]

if : a == [a11, a12, a13]
    print(Yes)
elif :is [a11, a22, a33]
    print(Yes)
elif :is [a11, a21, a31]
    print(Yes)
elif :is [a12, a22, a32]
    print(Yes)
elif :is [a13, a23, a33]
    print(Yes)
elif :is [a13, a22, a31]
    print(Yes)
elif :is [a21, a22, a23]
    print(Yes)
elif :is [a31, a32, a33]
    print(Yes)
else:
    print(No)

A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = []
for _ in range(N):
    B.append(input())

for b in B:
    for x in range(3):
        for y in range(3) :
            if A[x][y] == b:
                A[x][y] = 0

if A[0][0] * A[1][0] * A[2][0] == 0 or A[0][1] * A[1][1] * A[2][1] == 0 or A[0][2] * A[1][2] * A[2][2] == 0 or A[0][0] * A[0][1] * A[0][2] == 0 or A[1][0] * A[1][1] * A[1][2] == 0 or A[2][0] * A[2][1] * A[2][2] == 0 or A[0][0] * A[1][1] * A[2][2] == 0 or A[0][2] * A[1][1] * A[2][0] == 0:
    print("Yes")
else:
    print("No") 


A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for i in range(N)]
for b in B:
    for x in range(3):
        for y in range(3) :
            if A[x][y] == b:
                A[x][y] = 0

if A[0][0] + A[1][0] + A[2][0] == 0 \
or A[0][1] + A[1][1] + A[2][1] == 0 \
or A[0][2] + A[1][2] + A[2][2] == 0 \
or A[0][0] + A[0][1] + A[0][2] == 0 \
or A[1][0] + A[1][1] + A[1][2] == 0 \
or A[2][0] + A[2][1] + A[2][2] == 0 \
or A[0][0] + A[1][1] + A[2][2] == 0 \
or A[0][2] + A[1][1] + A[2][0] == 0:
    print("Yes")
else:
    print("No") 


Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Accepted