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:
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')

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')

Submission status: Wrong Answer

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

for _ in range(n):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if a[i][j] == b:
                a[i][j] = 0

lines = [[a[0][0], a[0][1], a[0][2]],
         [a[1][0], a[1][1], a[1][2]],
         [a[2][0], a[2][1], a[2][2]],
         [a[0][0], a[1][0], a[2][0]],
         [a[0][1], a[1][1], a[2][1]],
         [a[0][2], a[1][2], a[2][2]],
         [a[0][0], a[1][1], a[2][2]],
         [a[0][2], a[1][1], a[2][0]]]

for line in lines:
    if not all(line):
        print('Yes')
        exit()

print('No')

Submission status: Wrong Answer

Solution code:
import sys

an = []
for i in range(3):
  a = [int(num) for num in input().split()]
  an.append(a)

n = int(input())  

number = []
for i in range(n):
  number.append(int(input()))

for b in number:
  for i in range(3):
    for j in range(3):
      if b == an[i][j]:
        an[i][j] = 0

for i in range(3):
  if an[i][0] == an[i][1] and an[i][0] == an[i][2]:
    print("Yes")
    sys.exit()

for j in range(3):
  if an[0][j] == an[1][j] and an[0][j] == an[2][j]:
    print("Yes")
    sys.exit()    

if an[0][0] == an[1][1] and an[0][0] == an[2][2]:
  print("Yes")
  sys.exit() 

if an[0][2] == an[1][1] and an[0][0] == an[2][0]:
  print("Yes")
  sys.exit() 
    
print("No")

Submission status: Wrong Answer

Solution code:
import sys

an = []
for i in range(3):
  a = [int(num) for num in input().split()]
  an.append(a)

n = int(input())  

number = []
for i in range(n):
  number.append(int(input()))

for b in number:
  for i in range(3):
    for j in range(3):
      if b == an[i][j]:
        an[i][j] = 0

for i in range(3):
  if an[i][0] == an[i][1] and an[i][0] == an[i][2]:
    print("Yes")
    sys.exit()

for j in range(3):
  if an[0][j] == an[1][j] and an[0][j] == an[2][j]:
    print("Yes")
    sys.exit()    

if an[0][0] == an[1][1] and an[0][0] == an[2][2]:
  print("Yes")
  sys.exit() 

if an[0][2] == an[1][1] and an[0][0] == an[2][1]:
  print("Yes")
  sys.exit() 
    
print("No")

Submission status: Wrong Answer

Solution code:
A = {}
for i in range(1, 4):
    for j, a in enumerate(map(int, input().split()), 1):
        A[a] = (i,j)

memo = set()

N = int(input())
for _ in range(N):
    b = int(input())
    if b in A:
        memo.add(A[b])

bingo = [
    set([(1,1),(1,2),(1,3)]),
    set([(2,1),(2,2),(2,3)]),
    set([(3,1),(3,2),(3,3)]),
    set([(1,1),(2,2),(3,3)]),
    set([(3,1),(2,2),(1,3)])
]

for b in bingo:
    if len(b.intersection(memo)) == 3:
        print("Yes")
        break
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import numpy as np
A,N= np.array([list(map(int,input().split())) for _ in range(3)]),int(input())
b=[int(input()) for _ in range(N)]
for i in range(9):
  if A[i//3][i%3] in b:A[i//3][i%3]=0
print(['No','Yes'][int((A.sum(0)*A.sum(1)*A.diagonal()*A[::-1].diagonal()).prod()==0)])

Submission status: Wrong Answer

Solution code:
A=[[0 for i in range(3)] for j in range(3)]
for i in range(3):
  A[i] = list(map(int,input().split()))
N=int(input())
for i in range(N):
  b=int(input())
  for j in range(3):
    for k in range(3):
      if A[j][k] == b:
        A[j][k] = 0
bingo=0
sum1=0
sum2=0
sum3=0
sum4=0
sum5=0
for i in range(3):
  if sum(A[i]) == 0:bingo=1
  sum1 += A[0][i]
  sum2 += A[1][i]
  sum3 += A[2][i]
  sum4 += A[i][i]
  sum5 += A[i][2-i]
if 0 in [sum1,sum2,sum3,sum4,sum5]:bingo=1
print(['No','Yes'][bingo])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
#Atocoder ABC 157 B "Bingo"

a = list(map(int,input().split()))
b  = list(map(int,input().split()))
c  = list(map(int,input().split()))
box = [a,b,c]

N = int(input())
for i in range(N):
    s = int(input())
    for j in range(3):
        if s == a[j]:
            a[j] = 0
        if s == b[j]:        
            b[j] = 0
        if s == c[j]:        
            c[j] = 0

if box[1][1] == 0:
    if box[0][1] == 0 and box[2][1] == 0:
        print("Yes")
    elif box[1][0] == 0 and box[1][2] == 0:
        print("Yes")
    elif box[0][0] == 0 and box[2][2] == 0:
        print("Yes")
    elif box[0][2] == 0 and box[2][0] == 0:
        print("Yes")
        
elif box[0][0] == 0 and box[0][1] == 0:
    if box[0][2] == 0:
        print("Yes")
elif box[2][0] == 0 and box[2][1] == 0:
    if box[2][2] == 0:
        print("Yes")
elif box[0][0] == 0 and box[1][0] == 0:
    if box[2][0] == 0:
        print("Yes")
elif box[0][2] == 0 and box[1][2] == 0:
    if box[2][2] == 0:
        print("Yes")

else:
    print("No")

Submission status: Wrong Answer

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

ans = [[0] * 3] * 3


def is_bingo(card) -> bool:
    if card[0][0] == card[0][1] == card[0][2] == 1:
        return True
    if card[1][0] == card[1][1] == card[1][2] == 1:
        return True
    if card[2][0] == card[2][1] == card[2][2] == 1:
        return True
    if card[2][0] == card[2][1] == card[2][2] == 1:
        return True
    if card[0][0] == card[1][0] == card[2][0] == 1:
        return True
    if card[0][1] == card[1][1] == card[2][1] == 1:
        return True
    if card[0][2] == card[1][2] == card[2][2] == 1:
        return True
    if card[0][0] == card[1][1] == card[2][2] == 1:
        return True
    if card[0][2] == card[1][1] == card[2][0] == 1:
        return True
    return False


for b in B:
    for i, a in enumerate(A):
        if b in a:
            ans[i][a.index(b)] = 1
    if is_bingo(ans):
        print('Yes')
        exit()
print('No')

Submission status: Wrong Answer

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

val = 0
flag = False

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

val = A[0][2] + A[1][1] + A[2][0]
if val == 0:
    flag = True

for i in range(3):
    if sum(A[i]) == 0:
        flag = True
    
    val = 0
    for j in range(3):
        val += A[j][i]
    if val == 0:
        flag = True

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

Submission status: Wrong Answer

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

val = 0
flag = False

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

for i in range(3):
    val += A[i][i]

if val == 0:
    flag = True

val = A[0][2] + A[1][1] + A[2][0]
if val == 0:
    flag = True

val = 0
for i in range(3):
    for j in range(3):
        val += A[i][j]
    if val == 0:
        flag = True

val = 0
for i in range(3):
    for j in range(3):
        val += A[j][i]
    if val == 0:
        flag = True

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
A3 = list(map(int,input().split()))

n = int(input())

for _ in range(n):
    b = int(input())
    if b in A1:
        A1[A1.index(b)]=0
    if b in A2:
        A2[A2.index(b)]=0
    if b in A3:
        A3[A3.index(b)]=0
if sum(A1)==0 or sum(A2)==0 or sum(A3)==0 or A1[0]+A2[1]+A3[2]==0 or A1[2]+A2[1]+A3[0]==0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]


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

flag = False
if a[0][0] == 0 and a[0][1] == 0 and a[0][2] == 0:
    flag = True
if a[1][0] == 0 and a[1][1] == 0 and a[1][2] == 0:
    flag = True
if a[2][0] == 0 and a[2][1] == 0 and a[2][2] == 0:
    flag = True
if a[0][0] == 0 and a[1][0] == 0 and a[1][0] == 0:
    flag = True
if a[0][1] == 0 and a[1][1] == 0 and a[2][1] == 0:
    flag = True
if a[0][2] == 0 and a[1][2] == 0 and a[2][2] == 0:
    flag = True
if a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0:
    flag = True
if a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0:
    flag = True

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

Submission status: Wrong Answer

Solution code:
A = {}

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

for b in B:
  A[b] = True


A = list(A.values())


def check_row(A):
  return any(all(A[i:i+2]) for i in [0, 3, 6])
  
def check_col(A):
  return any(all(v for v in A[i::3]) for i in [0, 1, 2])

def check_diagonal(A):
  a = A[0] and A[4] and A[8]
  b = A[2] and A[4] and A[6]
  return a or b

cond = check_row(A) or check_col(A) or check_diagonal(A)
print("Yes" if cond else "No")

Submission status: Wrong Answer

Solution code:
def resolve():
    A = [list(map(int, input().split())) for _ in range(3)]
    N = int(input())
    B = [int(input()) for _ in range(N)]
    punch = [[False for _ in range(3)] for _ in range(3)]
    for i in range(3):
        for j in range(3):
            if A[i][j] in B:
                punch[i][j] = True
    ans = "No"
    for i in range(3):
        if False not in punch[i]:
            ans = "Yes"
            break
        for j in range(3):
            if not punch[i][j]:
                break
        else:
            ans = "Yes"
            break
    if (punch[0][0] and punch[1][1] and punch[2][2]) or (
            punch[0][2] and punch[1][1] and punch[2][0]):
        ans = "Yes"
    print(ans)


resolve()

Submission status: Wrong Answer

Solution code:
"""abc157_b"""

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

N = int(input())

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

for a in A:
    for i in range(3):
        if a[i] in B:
            a[i] = 0

ANS = "No"

for a in A:
    if sum(a) == 0:
        ANS = "Yes"
        break

verti = 0
for i in range(3):
    for j in range(3):
        verti += A[i][j]
    if verti == 0:
        ANS = "Yes"
        break
    verti = 0

if (A[0][0] + A[1][1] + A[2][2]) == 0:
    ANS = "Yes"

if (A[0][2] + A[1][1] + A[2][0]) == 0:
    ANS = "Yes"

print(ANS)

Submission status: Wrong Answer

Solution code:
import sys

bingo = [list(map(int,input().split())) for i in range(3)]
n = int(input())
hole = [[0,0,0]]*3

for i in range(n):
    a = int(input())
    for j in range(3):
        for k in range(3):
            if(bingo[j][k] == a):
                hole[j][k] = 1

for i in range(3):
    if(hole[i][0] == 1 and hole[i][1] == 1 and hole[i][2] == 1):
        print('Yes')
        sys.exit()

for i in range(3):
    if(hole[0][i] == 1 and hole[1][i] == 1 and hole[2][i] == 1):
        print('Yes')
        sys.exit()


if(hole[0][0] == 1 and hole[1][1] == 1 and hole[2][2] == 1):
    print('Yes')
elif(hole[0][2] == 1 and hole[1][1] == 1 and hole[2][0] == 1):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
def main():
    a = [[int(i) for i in input().split()] for _ in range(3)]
    n = int(input())
    ans = 'No'
    for i in range(n):
        b = int(input())
        for index, j in enumerate(a):
            if j[0] == b:
                a[index][0] = 0
            elif j[1] == b:
                a[index][1] = 0
            elif j[2] == b:
                a[index][2] = 0

    for i in a:
        if not any(a):
            ans = 'Yes'

    for i in zip(*a):
        if not any(a):
            ans = 'Yes'

    if not a[0][0] and not a[1][1] and not a[2][2]:
        ans = 'Yes'
    elif not a[0][2] and not a[1][1] and not a[2][0]:
        ans = 'Yes'

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
A=[list(map(int,input().split())) for _ in range(3)]
n=int(input())
B=[int(input()) for _ in range(n)] 
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]+A[i][1]+A[i][2]==0:
        ans="Yes"
    if A[0][i]+A[1][i]+A[2][i]==0:
        ans="Yes"
if A[0][0]+A[1][1]+A[2][2]==0:
    ans="Yes"
if A[0][2]+A[1][2]+A[2][0]==0:
    ans="Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    top = list(map(int, input().split()))
    middle = list(map(int, input().split()))
    bottom = list(map(int, input().split()))
    N = int(input())
    taken = []
    for i in range(N):
        taken.append(int(input()))
    
    bingo = []
    bingo.append(top)
    bingo.append(middle)
    bingo.append(bottom)
    temp = [top[0], middle[0], bottom[0]]
    bingo.append(temp)
    temp = [top[1], middle[1], bottom[1]]
    bingo.append(temp)
    temp = [top[2], middle[2], bottom[2]]
    bingo.append(temp)
    temp = [top[0], middle[1], bottom[2]]
    bingo.append(temp)
    temp = [top[2], middle[1], bottom[0]]


    cnt = 0
    flag = 0
    for i in range(len(bingo)):
        cnt = 0
        for j in range(len(bingo[i])):
            if bingo[i][j] in taken:
                cnt += 1
        if cnt == 3:
            flag += 1
    
    if flag > 0:
        print('Yes')
    else:
        print('No')
main()

Submission status: Wrong Answer

Solution code:
A_1 = list(map(int,input().split()))
A_2 = list(map(int,input().split()))
A_3 = list(map(int,input().split()))
N = int(input())
b=[]
for i in range(N):
    b.append(int(input()))
    
for i in b:
    for j in range(3):
        if A_1[j] == i:
            A_1[j] = -1

        if A_2[j] == i:
            A_1[j] = -1
            
        if A_3[j] == i:
            A_1[j] = -1


if A_1[0] == A_2[0] == A_3[0] == -1 or A_1[1] == A_2[1] == A_3[1] == -1 or A_1[2] == A_2[2] == A_3[2] == -1:
    print('Yes')
elif A_1[0] == A_1[1] == A_1[2] == -1 or A_2[0] == A_2[1] == A_2[2] == -1 or A_3[0] == A_3[1] == A_3[2] == -1:
    print('Yes')
elif A_1[0] == A_2[1] == A_3[2] == -1 or A_1[2] == A_2[1] == A_3[0] == -1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

n = int(input())
b = []
for i in range(n):
    b.append(int(input()))

if card[0][0] in b and card[1][1] in b and card[2][2] in b:
    print("Yes")
    exit()
elif card[0][2] in b and card[1][1] in b and card[2][0] in b:
    print("Yes")
    exit()

for i in range(3):
    if card[i][0] in b and card[i][1] in b and card[i][2] in b:
        continue
    else:
        break
else:
    print("Yes")
    exit()

for i in range(3):
    if card[0][i] in b and card[1][i] in b and card[2][i] in b:
        continue
    else:
        break
else:
    print("Yes")
    exit()

print("No")

Submission status: Wrong Answer

Solution code:
a=[]
for i in range(3):
    tmp=list(map(int,input().split()))
    a.append(tmp)
n=int(input())
b=[]
for i in range(n):
    tmp=int(input())
    b.append(tmp)
bingo = [[False,False,False]]*3
for i in range(n):
    for j in range(3):
        for k in range(3):
            if b[i]==a[j][k]:
                bingo[j][k]=True
flag = False
for i in range(3):
    if bingo[i][0]==True and bingo[i][1]==True and bingo[i][2]==True:
        flag=True
    if bingo[0][i]==True and bingo[1][i]==True and bingo[2][i]==True:
        flag=True
if bingo[0][0]==True and bingo[1][1]==True and bingo[2][2]==True:
    flag=True
if bingo[0][2]==True and bingo[1][1]==True and bingo[2][0]==True:
    flag=True
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a=[]
for i in range(3):
    tmp=list(map(int,input().split()))
    a.append(tmp)
n=int(input())
b=[]
for i in range(n):
    tmp=int(input())
    b.append(tmp)
bingo = [[False,False,False]]*3
for i in range(n):
    for j in range(3):
        for k in range(3):
            if b[i]==a[j][k]:
                bingo[j][k]=True
flag = False
for i in range(3):
    if bingo[i][0]==True and bingo[i][1]==True and bingo[i][2]==True:
        flag=True
        break
    if bingo[0][i]==True and bingo[1][i]==True and bingo[2][i]==True:
        flag=True
        break
if bingo[0][0]==True and bingo[1][1]==True and bingo[2][2]==True:
    flag=True
if bingo[0][2]==True and bingo[1][1]==True and bingo[2][0]==True:
    flag=True
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a=[]
for i in range(3):
    tmp=list(map(int,input().split()))
    a.append(tmp)
n=int(input())
b=[]
for i in range(n):
    tmp=int(input())
    b.append(tmp)
bingo = [[False,False,False]]*3
for i in range(n):
    for j in range(3):
        for k in range(3):
            if b[i]==a[j][k]:
                bingo[j][k]=True
flag = False
for i in range(3):
    if bingo[i][0]==True and bingo[i][1]==True and bingo[i][2]==True:
        flag=True
        break
    if bingo[0][i]==True and bingo[1][i]==True and bingo[2][i]==True:
        flag=True
        break
if bingo[0][0]==True and bingo[1][1]==True and bingo[2][2]==True:
    flag=True
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

card = [[0] * 3 for _ in range(3)]
for i in range(3):
    for j in range(3):
        if a[i][j] in b_list:
            card[i][j] = 1

for i in range(3):
    if sum(card[i]) == 3 or sum(card[:][i]) == 3:
        print('Yes')
        exit()
if sum([card[0][0], card[1][1], card[2][2]]) == 3 or sum([card[0][2], card[1][1], card[2][0]]) == 3:
    print('Yes')
    exit()
print('No')

Submission status: Wrong Answer

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

card = [[0] * 3 for _ in range(3)]
for i in range(3):
    for j in range(3):
        if a[i][j] in b_list:
            card[i][j] = 1

for i in range(3):
    if sum(card[i][:]) == 3 or sum(card[:][i]) == 3:
        print('Yes')
        exit()
if sum([card[0][0], card[1][1], card[2][2]]) == 3 or sum([card[0][2], card[1][1], card[2][0]]) == 3:
    print('Yes')
    exit()
print('No')

Submission status: Wrong Answer

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

card = [[0] * 3 for _ in range(3)]
for i in range(3):
    for j in range(3):
        if a[i][j] in b_list:
            card[i][j] = 1

for i in range(3):
    if card[i][:] == [1,1,1] or card[:][i] == [1,1,1]:
        print('Yes')
        exit()
if sum([card[0][0], card[1][1], card[2][2]]) == 3 or sum([card[0][2], card[1][1], card[2][0]]) == 3:
    print('Yes')
    exit()
print('No')

Submission status: Wrong Answer

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

card = [[0] * 3 for _ in range(3)]
for i in range(3):
    for j in range(3):
        if a[i][j] == b_list:
            card[i][j] = 1

for i in range(3):
    if card[i][:] == [1,1,1] or card[:][i] == [1,1,1]:
        print('Yes')
        exit()
if sum([card[0][0], card[1][1], card[2][2]]) == 3 or sum([card[0][2], card[1][1], card[2][0]]) == 3:
    print('Yes')
    exit()
print('No')

Submission status: Wrong Answer

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

card = [[0] * 3 for _ in range(3)]
for b in b_list:
    for i in range(3):
        for j in range(3):
            if a[i][j] == b:
                card[i][j] = 1

for i in range(3):
    if card[i][:] == [1,1,1] or card[:][i] == [1,1,1]:
        print('Yes')
        exit()
if [card[0][0], card[1][1], card[2][2]] == [1,1,1] or [card[0][2], card[1][1], card[2][0]] == [1,1,1]:
    print('Yes')
    exit()
print('No')

Submission status: Wrong Answer

Solution code:
bingo_int_list = [[int(i) for i in input().split()] for _ in range(3)]
N = int(input())
num_int_list = [int(input()) for _ in range(N)]
num_int_set = set(num_int_list)

bingo_bin_list = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]

for i in range(3):
    for j in range(3):
        if bingo_int_list[i][j] in num_int_set:
            bingo_bin_list[i][j] = 1

# check row
for i in range(3):
    if sum(bingo_bin_list[i]) == 3:
        print('Yes')
        exit()

# check column
for i in range(3):
    if bingo_bin_list[i][0] + bingo_bin_list[i][1] + bingo_bin_list[i][2] == 3:
        print('Yes')
        exit()

# check diagonal
if bingo_bin_list[0][0] + bingo_bin_list[1][1] + bingo_bin_list[2][2] == 3 or bingo_bin_list[0][2] + bingo_bin_list[1][
    1] + bingo_bin_list[2][0] == 3:
    print('Yes')
    exit()

print('No')

Submission status: Wrong Answer

Solution code:
#Bingo
bingo = [list(map(int,input().split())) for i in range(3)]
N = int(input())
b = [int(input()) for i in range(N)]
#縦横斜めで８通り。
cnt = [0]*8
for i in range(3):
    for j in range(3):
        if bingo[i][j] in b:
            cnt[i] += 1
            cnt[j+3] += 1
            if i == j:
                cnt[-1] += 1
            if i+j == 4:
                cnt[-2] += 1
ans = "No"
for i in cnt:
    if i >= 3:
        ans = "Yes"
        break
print(ans)

Submission status: Wrong Answer

Solution code:
a = [list(map(int, input().split())) for _ in range(3)]
x, y, z = a
x1, x2, x3 = x
y1, y2, y3 = y
z1, z2, z3 = z
n = int(input())
b = [int(input()) for _ in range(n)]
if x1 and x2 and x3 in b:
    print('Yes')
elif y1 and y2 and y3 in b:
    print('Yes')
elif z1 and z2 and z3 in b:
    print('Yes')
elif x1 and y1 and z1 in b:
    print('Yes')
elif x2 and y2 and z2 in b:
    print('Yes')
elif x3 and y3 and z3 in b:
    print('Yes')
elif x1 and y2 and z3 in b:
    print('Yes')
elif x3 and y2 and z1 in b:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import sys
import itertools as it


def isBingo(card):
    return card[0][0] and card[0][1] and card[0][2] \
        or card[1][0] and card[1][1] and card[1][2] \
        or card[2][0] and card[2][1] and card[2][2] \
        or card[0][0] and card[1][0] and card[2][0] \
        or card[0][1] and card[1][1] and card[2][1] \
        or card[0][2] and card[1][2] and card[2][2] \
        or card[0][0] and card[1][1] and card[2][2] \
        or card[0][2] and card[1][1] and card[2][0]


a = [row for row in map(lambda i:list(map(int, input().split())), range(3))]
n = int(input())
b = [int(input()) for i in range(n)]

res = [[False] * 3] * 3
for i in range(0, 3):
    for j in range(0, 3):
        for k in b:
            if a[i][j] == k:
                res[i][j] = True

print('Yes' if isBingo(res) else 'No')

Submission status: Wrong Answer

Solution code:
import sys
import itertools as it


def isBingo(card):
    return card[0][0] and card[0][1] and card[0][2] \
        or card[1][0] and card[1][1] and card[1][2] \
        or card[2][0] and card[2][1] and card[2][2] \
        or card[0][0] and card[1][0] and card[2][0] \
        or card[0][1] and card[1][1] and card[2][1] \
        or card[0][2] and card[1][2] and card[2][2] \
        or card[0][0] and card[1][1] and card[2][2] \
        or card[0][2] and card[1][1] and card[2][0]


a = [row for row in map(lambda i:list(map(int, input().split())), range(3))]
n = int(input())
b = [int(input()) for i in range(n)]

res = [[False] * 3] * 3
for i in range(0, 3):
    for j in range(0, 3):
        for k in b:
            if a[i][j] != k:
                continue
            res[i][j] = True
            break
print('Yes' if isBingo(res) else 'No')

Submission status: Wrong Answer

Solution code:
import sys
import itertools as it


def isBingo(card):
    return card[0][0] and card[0][1] and card[0][2] \
        or card[1][0] and card[1][1] and card[1][2] \
        or card[2][0] and card[2][1] and card[2][2] \
        or card[0][0] and card[1][0] and card[2][0] \
        or card[0][1] and card[1][1] and card[2][1] \
        or card[0][2] and card[1][2] and card[2][2] \
        or card[0][0] and card[1][1] and card[2][2] \
        or card[0][2] and card[1][1] and card[2][0]


a = [row for row in map(lambda i:list(map(int, input().split())), range(3))]
n = int(input())
b = [int(input()) for i in range(n)]

res = list(it.repeat(list(it.repeat(False, 3)), 3))
for i in range(0, 3):
    for j in range(0, 3):
        for k in b:
            if a[i][j] != k:
                continue
            res[i][j] = True
            break
print('Yes' if isBingo(res) else 'No')

Submission status: Wrong Answer

Solution code:
import sys
import itertools as it


def isBingo(card):
    return card[0][0] and card[0][1] and card[0][2] \
        or card[1][0] and card[1][1] and card[1][2] \
        or card[2][0] and card[2][1] and card[2][2] \
        or card[0][0] and card[1][0] and card[2][0] \
        or card[0][1] and card[1][1] and card[2][1] \
        or card[0][2] and card[1][2] and card[2][2] \
        or card[0][0] and card[1][1] and card[2][2] \
        or card[0][2] and card[1][1] and card[2][0]


a = [row for row in map(lambda i:list(map(int, input().split())), range(3))]
n = int(input())
b = list(map(int, input().split()))

res = list(it.repeat(list(it.repeat(False, 3)), 3))
for i in range(0, 3):
    for j in range(0, 3):
        for k in b:
            if a[i][j] != k:
                continue
            res[i][j] = True
            break
print('Yes' if isBingo(res) else 'No')

Submission status: Wrong Answer

Solution code:
A=[]
for i in range(3):
    A.append(list(map(int,input().split())))
print(A)
N=int(input())
b=[0 for i in range(N)]
for i in range(N):
    b[i]=int(input())
print(b)

for i in range(3):
    if(A[i][0] in b and A[i][1] in b and A[i][2] in b):
        print('Yes')
        exit()
    if(A[0][i] in b and A[1][i] in b and A[2][i] in b):
        print('Yes')
        exit()
if(A[0][0] in b and A[1][1] in b and A[2][2] in b):
    print('Yes')
    exit()
if(A[0][2] in b and A[1][1] in b and A[2][0] in b):
    print('Yes')
    exit()

print('No')

Submission status: Wrong Answer

Solution code:
def main():
    import itertools
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))
    c = list(map(int,input().split()))
    d = [a[0],b[0],c[0]]
    e = [a[1],b[1],c[1]]
    f = [a[2],b[2],c[2]]
    g = [a[0],b[1],c[2]]
    h = [a[2],b[1],c[0]]
    n = int(input())
    listB = [int(input()) for x in range(n)]
    C = itertools.combinations(listB,3)
    D = list(C)
    if a in D or b in D or c in D or d in D or e in D or f in D or g in D or h in D:
      print("Yes")
    else:
      print("No")
main()

Submission status: Wrong Answer

Solution code:
def main():
    import itertools
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))
    c = list(map(int,input().split()))
    d = [a[0],b[0],c[0]]
    e = [a[1],b[1],c[1]]
    f = [a[2],b[2],c[2]]
    g = [a[0],b[1],c[2]]
    h = [a[2],b[1],c[0]]
    n = int(input())
    listB = [int(input()) for x in range(n)]
    C = itertools.combinations(listB,3)
    if a in C or b in C or c in C or d in C or e in C or f in C or g in C or h in C:
      print("Yes")
    else:
      print("No")
main()

Submission status: Wrong Answer

Solution code:
"""
ABC 157 B-Bingo
"""
A = []
for i in range(3):
    a =  list(map(int,input().split()))
    A.append(a)
N = int(input())
for i in range(N):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if(A[j][k] == b):
                A[j][k] = 0

flag =False
check_v = 0
check_h = 0
check_c = 0
for i in range(3):
    for j in range(3):
        check_v += A[j][i]
        check_h += A[i][j]
        check_c += A[i][i]
if check_v == 0 or check_h == 0 or check_c == 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
al = [list(map(int, input().split())) for i in range(3)]
al = sum(al, [])
n = int(input())
bl = [int(input()) for i in range(n)]
check = [0 for i in range(9)]

for b in bl:
    if b in al:
        check[al.index(b)] = 1

if [1,1,1] in [check[:3], check[3:6], check[6:], check[0:7:3], check[1:8:3], check[2:9:3], check[0:9:4], check[3:8:2]]:
    print("Yes")
else:
    print("No")