Problem:


Score : 200 points

Problem Statement

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.

Constraints

All values in input are integers.

1 \leq A_{i, j} \leq 100

A_{i_1, j_1} \neq A_{i_2, j_2} ((i_1, j_1) \neq (i_2, j_2))

1 \leq N \leq 10

1 \leq b_i \leq 100

b_i \neq b_j (i \neq j)

Input

Input is given from Standard Input in the following format:

A_{1, 1} A_{1, 2} A_{1, 3}
A_{2, 1} A_{2, 2} A_{2, 3}
A_{3, 1} A_{3, 2} A_{3, 3}
N
b_1
\vdots
b_N

Output

If we will have a bingo, print Yes; otherwise, print No.

Sample Input 1

84 97 66
79 89 11
61 59 7
7
89
7
87
79
24
84
30

Sample Output 1

Yes

We will mark A_{1, 1}, A_{2, 1}, A_{2, 2}, A_{3, 3}, and complete the diagonal from the top-left to the bottom-right.

Sample Input 2

41 7 46
26 89 2
78 92 8
5
6
45
16
57
17

Sample Output 2

No

We will mark nothing.

Sample Input 3

60 88 34
92 41 43
65 73 48
10
60
43
88
11
48
73
65
41
92
34

Sample Output 3

Yes

We will mark all the squares.



Sample input:
84 97 66
79 89 11
61 59 7
7
89
7
87
79
24
84
30


Sample output:
Yes

Submission status: Wrong Answer

Solution code:
A = []
for _ in range(3):
    a = [int(a) for a in input().split()]
    A.append(a)
N = int(input())
for _ in range(N):
    num = int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j]==num:
                A[i][j] = -1

# Rows
for row in range(3):
    bingo_row = True
    for col in range(3):
        if A[row][col]!=-1:
            bingo_row = False
    if bingo_row:
        print('rows Yes')
        exit()
    
# Columns
for col in range(3):
    bingo_col = True
    for row in range(3):
        if A[row][col]!=-1:
            bingo_col = False
    if bingo_col:
        print('cols Yes')
        exit()

# Naname
bingo_naname = True
for i in range(3):
    col, row = i, i
    if A[row][col] != -1:
        bingo_naname = False
if bingo_naname:
    print('naname1 Yes')
    exit()
bingo_naname = True
for i in range(3):
    col, row = 2-i, i
    if A[row][col] != -1:
        bingo_naname = False
if bingo_naname:
    print('naname2 Yes')
    exit()

print('No')

Submission status: Wrong Answer

Solution code:
A = []
for _ in range(3):
    a = [int(a) for a in input().split()]
    A.append(a)
N = int(input())
for _ in range(N):
    num = int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j]==num:
                A[i][j] = -1

# Rows
for row in range(3):
    bingo_row = True
    for col in range(3):
        if A[row][col]!=-1:
            bingo_row = False
    if bingo_row:
        print('Yes')
        exit()
    
# Columns
for col in range(3):
    bingo_col = True
    for row in range(3):
        if A[row][col]!=-1:
            bingo_col = False
    if bingo_col:
        print('Yes')
        exit()

# Naname
bingo_naname = True
for i in range(3):
    col, row = i, i
    if A[row][col] != -1:
        bingo_naname = False
    if bingo_naname:
        print('Yes')
        exit()
bingo_naname = True
for i in range(3):
    col, row = 2-i, i
    if A[row][col] != -1:
        bingo_naname = False
    if bingo_naname:
        print('Yes')
        exit()

print('No')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
dic = defaultdict(list)
for i in range(3):
    a = list(map(int,input().split()))
    for j in range(3):
        dic[a[j]].append([i,j])
n = int(input())
B = []
for _ in range(n):
    b = int(input())
    B.append(b)
h = [0]*3
w = [0]*3
d = 0
di = 0
for b in B:
    if b not in dic:
        continue
    x,y = dic[b][0]
    if x== y:
        d += 1
    elif x + y ==2:
        di += 1
    h[x] += 1
    w[y] += 1
for i in range(3):
    if h[i]==3 or w[i]==3:
        print('Yes');exit()
if d ==3 or di ==3:
    print('Yes');exit()
print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np

bingo = []
for _ in range(3):
    array = list(map(int,input().split()))
    bingo.append(array)
bingo = np.array(bingo)
n = int(input())
bs = []
for _ in range(n):
    bs.append(int(input()))

for i in bs:
    bingo = np.where(bingo == i, 101, bingo)

h = False
if bingo[0][0] == bingo[1][1] == bingo[2][2]:
    h = True
if bingo[0][2] == bingo[1][1] == bingo[2][0]:
    h = True
for i in range(3):
    if bingo[i][0] == bingo[i][1] == bingo[i][2]:
        h = True
        break
for j in range(3):
    if bingo[0][i] == bingo[1][i] == bingo[2][i]:
        h = True
        break

print('Yes') if h == True else print('No')

Submission status: Wrong Answer

Solution code:
list = [list(map(int,input().split())) for i in range(3)]
N = int(input())
A = [[0] * 3 for i in range(3)]
for i in range(N):
  B = int(input())
  for j in range(3):
    for k in range(3):
      if list[j][k] == B:
        A[j][k] += 1
        
result = A[0][0] * A[0][1] * A[0][2]
result += A[1][0] * A[1][1] * A[1][2]
result += A[2][0] * A[2][1] * A[2][2]
result += A[0][0] * A[1][0] + A[2][0]
result += A[0][1] * A[1][1] + A[2][1]
result += A[0][2] * A[1][2] + A[2][2]
result += A[0][0] * A[1][1] + A[2][2]
result += A[0][2] * A[1][1] + A[2][0]
if result >= 1:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
A=[list(map(int,input().split())) for _ in range(3)]
b=[i for i in [int(input()) for _ in range(int(input()))] for j in A if i in j]
A=[[1 if A[i][j] in b else 0 for j in range(len(A[i]))] for i in range(len(A))]
print('NYoe s'[any([sum(i) for i in A]) or any([sum(i) for i in list(zip(*A))]) or all([A[0][0],A[1][1],A[2][2]]) or all([A[0][2],A[1][1],A[2][0]])::2])

Submission status: Wrong Answer

Solution code:
A=[list(map(int,input().split())) for _ in range(3)]
b=[i for i in [int(input()) for _ in range(int(input()))] for j in A if i in j]
A=[[1 if A[i][j] in b else 0 for j in range(len(A[i]))] for i in range(len(A))]
print('NYoe s'[any([sum(i) for i in A]) or any([sum(i) for i in list(zip(*A))]) or A[0][0]+A[1][1]+A[2][2] or A[0][2]+A[1][1]+A[2][0]::2])

Submission status: Wrong Answer

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

N = int(input())
B = set()
for _ in range(N):
    B.add(int(input()))

for i in range(3):
    for j in range(3):
        if A[i][j] in B:
            A[i][j] = -1

Q = [-1,-1,-1]
for i in range(3):
    if A[i] == Q:
        print("Yes")
        exit()
A = list(zip(*A))
for i in range(3):
    if A[i] == Q:
        print("Yes")
        exit()

if A[0][0] == A[1][1] == A[2][2] or A[0][2] == A[1][1] == A[2][0]:
    print("Yes")
    exit()

print("No")

Submission status: Wrong Answer

Solution code:
A=[list(map(int,input().split())) for _ in range(3)]
b=[i for i in [int(input()) for _ in range(int(input()))] for j in A if i in j]
A=[[0 if A[i][j] in b else 1 for j in range(len(A[i]))] for i in range(len(A))]
print('NYoe s'[not [sum(i) for i in A] or not [sum(i) for i in list(zip(*A))] or not A[0][0]+A[1][1]+A[2][2] or not A[0][2]+A[1][1]+A[2][0]::2])

Submission status: Wrong Answer

Solution code:
A=[list(map(int,input().split())) for _ in range(3)]
b=[i for i in [int(input()) for _ in range(int(input()))] for j in A if i in j]
A=[[0 if A[i][j] in b else A[i][j] for j in range(len(A[i]))] for i in range(len(A))]
print('NYoe s'[not [1 for i in A if sum(i)!=0] or not [1 for i in list(zip(*A)) if sum(i)!=0] or not A[0][0]+A[1][1]+A[2][2] or not A[0][2]+A[1][1]+A[2][0]::2])

Submission status: Wrong Answer

Solution code:
X=[list(map(int,input().split()))for i in range(3)]
b=[int(input())for i in range(int(input()))]
for i in range(3):
 X[i]=[1 if i in b else 0 for i in X[i]]
print("Yes" if 3>=max(*[sum(i)for i in X],*[sum([x[i] for x in X])for i in range(3)],X[0][0]+X[1][1]+X[2][2],X[0][2]+X[1][1]+X[2][0]) else "No")

Submission status: Wrong Answer

Solution code:
A=[list(map(int,input().split()))for i in range(3)]
b=[int(input())for i in range(int(input()))]
X=[0]*3
for i in range(3):
 X[i]=[1 if i in b else 0 for i in A[i]]
R=[*[sum(i)for i in X],*[sum([x[i] for i in range(3)]) for x in X ],X[0][0]+X[1][1]+X[2][2],X[0][2]+X[1][1]+X[2][0]]
print("Yes" if 3<=max(R) else "No")

Submission status: Wrong Answer

Solution code:
X=[list(map(int,input().split()))for i in range(3)]
b=[int(input())for i in range(int(input()))]
for i in range(3):
 X[i]=[1 if i in b else 0 for i in X[i]]
print("Yes" if 3==max(*[sum(i)for i in X],*[sum([x[i] for i in range(3)]) for x in X ],X[0][0]+X[1][1]+X[2][2],X[0][2]+X[1][1]+X[2][0]) else "No")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    bingo_num = []

    for i in range(3):
        N = LI()
        bingo_num.append(N)

    N = II()

    for i in range(N):
        b = II()
        for row_i in range(3):
            for col_j in range(3):
                if bingo_num[row_i][col_j] == b:
                    bingo_num[row_i][col_j] = 0

    for i in range(3):
        if sum(bingo_num[row_i]) == 0:
            print("Yes")
            exit()

    for j in range(3):
        if bingo_num[0][j] + bingo_num[1][j] + bingo_num[2][j] == 0:
            print("Yes")
            exit()

    sum_naname = 0
    sum_naname_2 = 0
    for i in range(3):
        sum_naname += bingo_num[i][i]
        sum_naname_2 += bingo_num[i][2 - i]

    if sum_naname == 0 or sum_naname_2 == 0:
        print("Yes")
        exit()
    print("No")


main()

Submission status: Wrong Answer

Solution code:
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)
 
def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
 
def main():
    A = [LI() for _ in range(3)]
    N = I()
    B = [I() for _ in range(N)]
    # print(B) 
    
    for i in range(3):
        for j in range(3):
            for k in range(N):
                if A[i][j]== B[k]:
                    A[i][j] = True
                    break
    
    ans = False
    for i in range(3):
            if (A[i][0] and A[i][1] and A[i][2]) or (A[0][i] and A[1][i] and A[2][i]):
              ans = True
              break  
    if (A[0][2] and A[1][1] and A[2][0]) or (A[0][0] and A[1][1] and A[2][2]):
        ans = True

    if ans:
        print('Yes')
    else:
        print('No')
main()

Submission status: Wrong Answer

Solution code:
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)
 
def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
 
def main():
    A = [LI() for _ in range(3)]
    N = I()
    B = [I() for _ in range(N)]
    # print(B) 
    
    for i in range(3):
        for j in range(3):
            for k in range(N):
                if A[i][j]== B[k]:
                    A[i][j] = 0
                    break

    ans = 'No'
    for i in range(3):
            if (A[i][0]==0 and A[i][1]==0 and A[i][2]==0) or (A[0][i]==0 and A[1][i]==0 and A[2][i]==0):
              ans = 'Yes'
              break  
    if (A[0][2]==0 and A[1][1]==0 and A[2][0]==0) or A[0][0]==0 and A[1][1]==0 and A[2][2]:
        ans = 'Yes'
    print(ans)
main()

Submission status: Wrong Answer

Solution code:
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)
 
def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
 
def main():
    A = [LI() for _ in range(3)]
    N = I()
    B = [I() for _ in range(N)]
    # print(B) 
    
    for i in range(3):
        for j in range(3):
            for k in range(N):
                if A[i][j]== B[k]:
                    A[i][j] = 0

    ans = 'No'
    for i in range(3):
            if (A[i][0]==0 and A[i][1]==0 and A[i][2]==0) or (A[0][i]==0 and A[1][i]==0 and A[2][i]==0):
              ans = 'Yes'
              break  
    if (A[0][0]==0 and A[1][1]==0 and A[2][2]==0) or A[2][0]==0 and A[1][1]==0 and A[0][2]:
        ans = 'Yes'
    print(ans)
main()

Submission status: Wrong Answer

Solution code:
def judge(l):
    #yoko
    if sum(l[0]) or sum(l[1]) or sum(l[2]):
        return 1
    else:
        if l[0][0]+l[1][0]+l[2][0] == 3:
            return 1
        elif l[0][1]+l[1][1]+l[2][1] == 3:
            return 1
        elif l[0][2]+l[1][2]+l[2][2] == 3:
            return 1
        else:
            if l[0][0]+l[1][1]+l[2][2] == 3:
                return 1
            elif l[0][2]+l[1][1]+l[2][0] == 3:
                return 1
            else:
                return 0

A1 = [int(i) for i in input().split(' ')]
A2 = [int(i) for i in input().split(' ')]
A3 = [int(i) for i in input().split(' ')]
N = int(input())
bs = []
for n in range(N):
    bs.append(int(input()))

dic = {}
for i,a in enumerate(A1):
    dic[a] = (0,i)
for i,a in enumerate(A2):
    dic[a] = (1,i)
for i,a in enumerate(A3):
    dic[a] = (2,i)

l = [[0,0,0],[0,0,0],[0,0,0]]
for b in bs:
    if b in dic:
        index = dic[b]
        l[index[0]][index[1]] = 1

if judge(l) == 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
def judge(l):
    #yoko
    if sum(l[0]) or sum(l[1]) or sum(l[2]):
        return 1
    else:
        if l[0][0]+l[1][0]+l[2][0] == 3:
            return 1
        elif l[0][1]+l[1][1]+l[2][1] == 3:
            return 1
        elif l[0][1]+l[1][1]+l[2][1] == 3:
            return 1
        else:
            if l[0][0]+l[1][1]+l[2][2] == 3:
                return 1
            elif l[0][2]+l[1][1]+l[2][0] == 3:
                return 1
            else:
                return 0

A1 = [int(i) for i in input().split(' ')]
A2 = [int(i) for i in input().split(' ')]
A3 = [int(i) for i in input().split(' ')]
N = int(input())
bs = []
for n in range(N):
    bs.append(int(input()))

dic = {}
for i,a in enumerate(A1):
    dic[a] = (0,i)
for i,a in enumerate(A2):
    dic[a] = (1,i)
for i,a in enumerate(A3):
    dic[a] = (2,i)

l = [[0,0,0],[0,0,0],[0,0,0]]
for b in bs:
    if b in dic:
        index = dic[b]
        l[index[0]][index[1]] = 1

if judge(l) == 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys

A = [0 for _ in range(3)]
for i in range(3):
    A[i] = list(map(int, input().split()))

N = int(input())
B = [0 for _ in range(N)]
for i in range(N):
    B[i] = int(input())


def bingo_judge(A, B):
    # 縦列のビンゴを判定
    for i in range(3):
        flag = True
        for a in [A[0][i], A[1][i], A[2][i]]:
            if not (a in B):
                flag = False
        if flag:
            print("Yes")
            sys.exit()
    # 横列のビンゴを判定
    for i in range(3):
        flag = True
        for a in A[i]:
            if not (a in B):
                flag = False
        if(flag):
            print("Yes")
            sys.exit()
    # 斜めのビンゴを判定
    for a in [A[0][0], A[1][1], A[2][2]]:
        flag = True
        if not (a in B):
            flag = False
    if flag:
        print("Yes")
        sys.exit()
    
    for a in [A[0][2], A[1][1], A[2][0]]:
        flag = True
        if not (a in B):
            flag = False
    if flag:
        print("Yes")
        sys.exit()
    print("No")


bingo_judge(A, B)

Submission status: Wrong Answer

Solution code:
import sys

A = [0 for _ in range(3)]
for i in range(3):
    A[i] = list(map(int, input().split()))

N = int(input())
B = [0 for _ in range(N)]
for i in range(N):
    B[i] = int(input())


def bingo_judge(A, B):
    # 縦列のビンゴを判定
    for i in range(3):
        flag = True
        for a in [A[0][i], A[1][i], A[2][i]]:
            if not (a in B):
                flag = False
        if flag:
            print("Yes")
            sys.exit()
    # 横列のビンゴを判定
    for i in range(3):
        flag = True
        for a in A[i]:
            if not (a in B):
                flag = False
        if(flag):
            print("Yes")
            sys.exit()
    # 斜めのビンゴを判定
    for a in [A[0][0], A[1][1], A[2][2]]:
        flag = True
        if not (a in B):
            flag = False
    if flag:
        print("Yes")
        sys.exit()
    flag = True
    for a in [A[0][2], A[1][1], A[2][0]]:
        if not (a in B):
            flag = False
    if flag:
        print("Yes")
        sys.exit()
    print("No")


bingo_judge(A, B)

Submission status: Wrong Answer

Solution code:
import sys

A = [0 for _ in range(3)]
for i in range(3):
    A[i] = list(map(int, input().split()))

N = int(input())
B = [0 for _ in range(N)]
for i in range(N):
    B[i] = int(input())


def bingo_judge(A, B):
    # 縦列のビンゴを判定
    flag = True
    for i in range(3):
        for a in [A[0][i], A[1][i], A[2][i]]:
            if not (a in B):
                flag = False
        if flag:
            print("Yes")
            sys.exit()
    # 横列のビンゴを判定
    flag = True
    for i in range(3):
        for a in A[i]:
            if not (a in B):
                flag = False
        if(flag):
            print("Yes")
            sys.exit()
    # 斜めのビンゴを判定
    flag = True
    for a in [A[0][0], A[1][1], A[2][2]]:
        if not (a in B):
            flag = False
    if flag:
        print("Yes")
        sys.exit()
    flag = True
    for a in [A[0][2], A[1][1], A[2][0]]:
        if not (a in B):
            flag = False
    if flag:
        print("Yes")
        sys.exit()
    print("No")


bingo_judge(A, B)

Submission status: Wrong Answer

Solution code:
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l3 = list(map(int, input().split()))
l = l1 + l2 + l3
n = int(input())

bl = [int(input()) for _ in range(n)]

for i in range(len(l)):
    for j in bl:
        if l[i] == j:
            l[i] = 0
rowwise = 1 if (sum(l[0:3]) == 0) | (sum(l[3:6]) == 0)  | (sum(l[6:-1]) == 0) else 0
colwise = 1 if (sum([l[0], l[3], l[6]]) == 0) | (sum([l[1], l[4], l[7]]) == 0)  | (sum([l[2], l[5], l[8]]) == 0) else 0
crosswise = 1 if (sum([l[0], l[4], l[-1]]) == 0) | (sum([l[2], l[4], l[6]]) == 0) else 0

print("Yes" if sum([rowwise, colwise, crosswise]) else "No")

Submission status: Wrong Answer

Solution code:
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l3 = list(map(int, input().split()))
l = l1 + l2 + l3
n = int(input())

bl = [int(input()) for _ in range(n)]

for i in range(len(l)):
    for j in bl:
        if l[i] == j:
            l[i] = 0
rowwise = 1 if (sum(l[0:3]) == 0) | (sum(l[3:6]) == 0)  | (sum(l[6:-1]) == 0) else 0
colwise = 1 if (sum([l[0], l[3], l[6]]) == 0) | (sum([l[1], l[4], l[7]]) == 0)  | (sum([l[2], l[5], l[8]]) == 0) else 0
crosswise = 1 if (sum([l[0], l[4], l[-1]]) ==0) | (sum([l[2], l[4], l[-6]]) == 0) else 0

print("Yes" if sum([rowwise, colwise, crosswise]) else "No")

Submission status: Wrong Answer

Solution code:
ARR = [
    [84, 97, 66],
    [79, 89, 11],
    [61, 59, 7],
]


N = 7
BRR = [
    89,
    7,
    87,
    79,
    24,
    84,
    30,
]


ARR = []

for i in range(3):
    ARR.append(list(map(int,input().split())))

N = int(input())

BRR = []

for i in range(N):
    BRR.append(int(input()))


def calculagte(arr, n, brr):
    status = [
        [False, False, False],
        [False, False, False],
        [False, False, False]
    ]

    for h in range(3):
        for w in range(3):
            for i in range(n):
                if arr[h][w] == brr[i]:
                    status[h][w] = True

    isOk = False

    if status[0][0] and status[0][1] and status[0][2]:
        isOk = True

    if status[1][0] and status[1][1] and status[1][2]:
        isOk = True

    if status[2][0] and status[2][1] and status[2][2]:
        isOk = True


    if status[0][0] and status[1][0] and status[2][0]:
        isOk = True

    if status[0][1] and status[1][1] and status[2][1]:
        isOk = True

    if status[0][2] and status[1][2] and status[2][2]:
        isOk = True

    if status[0][0] and status[1][1] and status[2][2]:
        isOk = True

    if isOk:
        print("Yes")
    else:
        print("No")

calculagte(ARR, N, BRR)

Submission status: Wrong Answer

Solution code:
A = ['']*3
for i in range(3):
    A[i] = list(map(int,input().split()))
N = int(input())
B = [0]*N
for i in range(N):
    B[i] = int(input())

# print(A)
# print(A[0][0])
# print(A[0].index(66))
for b in B:
    for i in range(3):
        if b in A[i]:
            # print(b)
            A[i][A[i].index(b)] = 0
        


flag = False
for i in range(3):
    if A[i][0] == A[i][1] == A[i][2] == 0:
        flag = True
    if A[0][i] == A[1][i] == A[2][i] == 0:
        flag = True
if A[0][0] == A[1][1] == A[2][2] == 0:
    flag = True

if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np
A=[]
for _ in range(3):
  A.append(list(map(int,input().split())))

def bingo(x):
  a=False
  for s in range(3):
    if sum(x[s])==3:a=True
  
  for h in range(3):
    if x[0][i]+x[1][i]+x[2][i]==3:a=True
      
  if x[0][0]+x[1][1]+x[2][2]==3:a=True
  
  if x[0][2]+x[1][1]+x[2][0]==3:a=True
    
  return a
 
seen=[[0,0,0] for _ in range(3)]
for _ in range(int(input())):
  a=int(input())
  
  for i in range(3):
    for j in range(3):
      if A[i][j]==a:seen[i][j]=1

ff=bingo(seen)

if ff==True:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np
A=[]
for _ in range(3):
  A.append(list(map(int,input().split())))

def bingo(x):
  a=False
  for s in range(3):
    if sum(x[0])==3:a=True
  
  for h in range(3):
    if x[0][i]+x[1][i]+x[2][i]==3:a=True
      
  if x[0][0]+x[1][1]+x[2][2]==3:a=True
  
  if x[0][2]+x[1][1]+x[2][0]==3:a=True
    
  return a
 
seen=[[0,0,0] for _ in range(3)]
for _ in range(int(input())):
  a=int(input())
  
  for i in range(3):
    for j in range(3):
      if A[i][j]==a:seen[i][j]=1

ff=bingo(seen)

if ff==True:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np
A=[]
for _ in range(3):
  A.append(list(map(int,input().split())))

def bingo(x):
  a=False
  for s in range(3):
    if sum(x[0])==3:a=True
  
  for h in range(3):
    if x[i][0]+x[i][1]+x[i][2]==3:a=True
      
  if x[0][0]+x[1][1]+x[2][2]==3:a=True
  
  if x[0][2]+x[1][1]+x[2][0]==3:a=True
    
  return a
 
seen=[[0,0,0] for _ in range(3)]
for _ in range(int(input())):
  a=int(input())
  
  for i in range(3):
    for j in range(3):
      if A[i][j]==a:seen[i][j]=1

ff=bingo(seen)

if ff==True:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
l = [list(map(int,input().split())) for i in range(3)]
N = int(input())
q = [int(input()) for i in range(N)]
print(q)
for i in range(3):
  for j in range(3):
    for k in range(N):

      if l[i][j] == q[k]:
        l[i][j] = 0
        
      if l[0][0] == 0 and l[0][1] == 0 and l[0][2] == 0:
        print('Yes')
        exit()
      elif l[1][0] == 0 and l[1][1] == 0 and l[1][2] == 0:
        print("Yes")
        exit()
      elif l[2][0] == 0 and l[2][1] == 0 and l[2][2] == 0:
        print("Yes")
        exit()
      elif l[0][0] == 0 and l[1][1] == 0 and l[2][2] == 0:
        print("Yes")
        exit()
      elif l[0][2] == 0 and l[1][1] == 0 and l[2][0] == 0:
        print("Yes")
        exit()
      elif l[0][0] == 0 and l[1][0] == 0 and l[2][0] == 0:
        print("Yes")
        exit()
      elif l[0][1] == 0 and l[1][1] == 0 and l[2][1] == 0:
        print("Yes")
        exit()
      elif l[0][2] == 0 and l[1][2] == 0 and l[2][2] == 0:
        print("Yes")
        exit()

print('No')

Submission status: Wrong Answer

Solution code:
bingo = [list(map(int,input().split())) for i in range(3)]
n = int(input())
num = [int(input()) for _ in range(n)]
print(bingo)

for i in range(3):
  for j in range(3):
    if bingo[i][j] in num:
      bingo[i][j] = 0
print(bingo)

for i in range(3):
  if bingo[i].count(0) == 3:
    print("Yes")
    exit()
  elif bingo[0][i] == 0 and bingo[1][i] == 0 and bingo[2][i] == 0:
    print("Yes")
    exit()
  else:
    pass

if bingo[0][0] == 0 and bingo[1][1] == 0 and bingo[2][2] ==0:
  print("Yes")
  exit()
elif bingo[0][2] == 0 and bingo[1][1] == 0 and bingo[2][0] == 0:
  print("Yes")
  exit()
else:
  print("No")

Submission status: Wrong Answer

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

def bingo(x):
  a=False
  for s in range(3):
    if sum(x[0])==3:a=True
  
  for h in range(3):
    if x[i][0]+x[i][1]+x[i][2]==3:a=True
      
  if x[0][0]+x[1][1]+x[2][2]==3:a=True
  
  if x[0][2]+x[1][1]+x[2][0]==3:a=True
    
  return a


for _ in range(int(input())):
  seen=[[0,0,0] for _ in range(3)]
  a=int(input())
  
  for i in range(3):
    for j in range(3):
      if A[i][j]==a:seen[i][j]=1
        
  ff=bingo(seen)
  if ff==True:
    print('Yes')
    exit()
      
print('No')

Submission status: Wrong Answer

Solution code:
row_1 = list(map(int, input().split()))
row_2 = list(map(int, input().split()))
row_3 = list(map(int, input().split()))
N = int(input())
numbers_called = []
for i in range(N):
    b = int(input())
    numbers_called.append(b)

col_1 = [row_1[0], row_2[0], row_3[0]]
col_2 = [row_1[1], row_2[1], row_3[1]]
col_3 = [row_1[2], row_2[2], row_3[2]]
diagonal = [row_1[0], row_2[1], row_3[2]]
anti_diagonal = [row_3[0], row_2[1], row_1[2]]

winning_combinations = [row_1, row_2, row_3, col_1, col_2, col_3, diagonal, anti_diagonal]

is_bingo = True
for combination in winning_combinations:
    for number in combination:
        if number not in numbers_called:
            is_bingo = False
        
        if is_bingo:
            break

    if is_bingo:
        break

if is_bingo:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
row_1 = list(map(int, input().split()))
row_2 = list(map(int, input().split()))
row_3 = list(map(int, input().split()))
N = int(input())
numbers_called = []
for i in range(N):
    b = int(input())
    numbers_called.append(b)

col_1 = [row_1[0], row_2[0], row_3[0]]
col_2 = [row_1[1], row_2[1], row_3[1]]
col_3 = [row_1[2], row_2[2], row_3[2]]
diagonal = [row_1[0], row_2[1], row_3[2]]
anti_diagonal = [[row_3[0], row_2[1], row_1[2]]]

winning_combinations = [row_1, row_2, row_3, col_1, col_2, col_3, diagonal, anti_diagonal]

is_bingo = True
for combination in winning_combinations:
    for number in combination:
        if number not in numbers_called:
            is_bingo = False
        
        if is_bingo:
            break

    if is_bingo:
        break

if is_bingo:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
row_1 = list(map(int, input().split()))
row_2 = list(map(int, input().split()))
row_3 = list(map(int, input().split()))
N = int(input())
numbers_called = []
for i in range(N):
    b = int(input())
    numbers_called.append(b)

col_1 = [row_1[0], row_2[0], row_3[0]]
col_2 = [row_1[1], row_2[1], row_3[1]]
col_3 = [row_1[2], row_2[2], row_3[2]]
diagonal = [row_1[0], row_2[1], row_3[2]]
anti_diagonal = [[row_3[0], row_2[1], row_1[0]]]

winning_combinations = [row_1, row_2, row_3, col_1, col_2, col_3, diagonal, anti_diagonal]
is_bingo = True
for combination in winning_combinations:
    for number in combination:
        if number not in numbers_called:
            is_bingo = False
        
        if is_bingo:
            break

    if is_bingo:
        break

if is_bingo:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
row_1 = list(map(int, input().split()))
row_2 = list(map(int, input().split()))
row_3 = list(map(int, input().split()))
N = int(input())
numbers_called = []
for i in range(N):
    b = int(input())
    numbers_called.append(b)

col_1 = [row_1[0], row_2[0], row_3[0]]
col_2 = [row_1[1], row_2[1], row_3[1]]
col_3 = [row_1[2], row_2[2], row_3[2]]
diagonal = [row_1[0], row_2[1], row_3[2]]
anti_diagonal = [[row_3[0], row_2[1], row_1[0]]]

winning_combinations = [row_1, row_2, row_3, col_1, col_2, col_3, diagonal, anti_diagonal]
for combination in winning_combinations:
    for number in combination:
        is_bingo = True
        if number not in numbers_called:
            is_bingo = False
        
        if is_bingo:
            print('Yes')
print('No')

Submission status: Wrong Answer

Solution code:
a = []
for i in range(3):
  d, b, c = map(int, input().split())
  a.append(d)
  a.append(b)
  a.append(c)
for _ in range(int(input())):
  n = int(input())
  if(n in a):
    a[a.index(n)] = 0
retsu = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]]
frag = False
for i in range(8):
  frag1 = True
  for s in retsu[i]:
    if(a[s] > 0):
      frag1 = False
if(frag):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import itertools
import sys

def f_row(L):
  for i in range(3):
    for j in range(3):
      if L[i][j] == False:
        break
      elif j == 2:
        return True
      else:
        continue
  return False

def f_col(L):
  for i in range(3):
    for j in range(3):
      if L[j][i] == False:
        break
      elif j == 2:
        return True
      else:
        continue
  return False
        
def f_rcross(L):
  for i in range(3):
    if L[i][i] == False:
      break
    elif i == 2:
      return True
    else:
      continue
  return False
      
def f_lcross(L):
  for i in range(3):
    if L[i][2-i] == False:
      break
    elif i == 2:
      return True
    else:
      continue
  return False

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

L = [[False, False, False]]*3

for b in B:
  for i, j in itertools.product(range(3), repeat=2):
    if b == A[i][j]:
      L[i][j] = True
  if f_row(L) or f_col(L) or f_rcross(L) or f_lcross(L):
    print('Yes')
    sys.exit()
print('No')

Submission status: Wrong Answer

Solution code:
l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
l3=list(map(int,input().split()))
flag=0
n=int(input())
for i in range(n):
  a=int(input())
  if a in l1 or a in l2 or a in l3:
    flag=1 
if(flag==1):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import sys

A = [list(map(int,input().split())) for i in range(3)]
N = int(input())
b = [int(input()) for i in range(N)]

for i in range(N):
  for j in range(3):
    for k in range(3):
      if b[i] == A[j][k]:
        A[j][k] = 0

for i in range(3):
  if sum(A[i][:]) == 0:
    print('Yes')
    sys.exit()
  if sum(A[:][i]) == 0:
    print('Yes')
    sys.exit()

if (A[0][0]+A[1][1]+A[2][2]) == 0:
  print('Yes')
  sys.exit()
if (A[0][2]+A[1][1]+A[2][0]) == 0:
  print('Yes')
  sys.exit()

print('No')