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:
# coding: utf-8
# Your code here!
bingo =[]

for i in range(3):
    bingo.append(input().split())
    
for i in range(3):
    for j in range(3):
        bingo[i][j] = int(bingo[i][j])

N = input()

b = []

for i in range(int(N)):
    bn = int(input())
    b.append(bn)
    
    for i in range(3):
        for j in range(3):
            if(bn == bingo[i][j]):
                bingo[i][j] = -1
        
    

hantei = "NO"
for i in range(3):
    if(bingo[0][i] + bingo[0][i] + bingo[0][i] < 1):
        hantei = "YES"
    
for i in range(3):
    if(bingo[i][0] + bingo[i][1] + bingo[i][2] < 1):
        hantei = "YES"
  
if(bingo[0][0] + bingo[1][1] + bingo[2][2] < 1):
        hantei = "YES"
elif(bingo[0][2] + bingo[1][1] + bingo[2][0] < 1):
        hantei = "YES"


print(hantei)

Submission status: Wrong Answer

Solution code:
A11,A12,A13 = map(int, input().split())
A21,A22,A23 = map(int, input().split())
A31,A32,A33 = map(int, input().split())
N = int(input())
b = [int(input()) for _ in range(N)]

cnt11=0
cnt12=0
cnt13=0
cnt21=0
cnt22=0
cnt23=0
cnt31=0
cnt32=0
cnt33=0

for i in range(N):
    if b[i]==A11:
        cnt11+=1
    elif b[i]==A12:
        cnt12+=1
    elif b[i]==A13:
        cnt13+=1
    elif b[i]==A21:
        cnt21+=1
    elif b[i]==A22:
        cnt22+=1
    elif b[i]==A23:
        cnt23+=1
    elif b[i]==A31:
        cnt31+=1
    elif b[i]==A32:
        cnt32+=1
    elif b[i]==A33:
        cnt33+=1
    else:
        pass

bingo=0
if cnt11>0:
    if((cnt12>0 and cnt13>0)or(cnt22>0 and cnt33>0)or(cnt21>0 and cnt31>0)):
        bingo+=1
    else:
        pass
elif cnt12>0:
    if (cnt22>0 and cnt32>0):
        bingo+=1
    else:
        pass
elif cnt13>0:
    if((cnt22>0 and cnt31>0)or(cnt23>0 and cnt33>0)):
        bingo+=1
    else:
        pass
elif cnt21>0:
    if(cnt22>0 and cnt23>0):
        bingo+=1
    else:
        pass
elif cnt31>0:
    if(cnt32>0 and cnt33>0):
        bingo+=1
    else:
        pass
else:
    pass
if bingo>0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys
 
A = []
for i in range(3):
    array = list(map(int, input().split()))
    A.append(array)
N = int(input())
b = []
for i in range(N):
    k = int(input())
    b.append(k)
for k in b:
    for row in A:
        for elem in row:
            if k == elem:
                elem = 0
 
 
row = np.sum(A, axis=1)
for i in range(3):
    if row[i] == 0:
        print('Yes')
        sys.exit()
 
 
col = np.sum(A, axis=0)
for i in range(3):
    if col[i] == 0:
        print('Yes')
        sys.exit()
 
c = 0
for i in range(3):
    c += A[i][i]
if c == 0:
    print('Yes')
    sys.exit()
 
c = 0
for i in range(3):
    c += A[3-i-1][i]
if c == 0:
    print('Yes')
    sys.exit()
 
print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys

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

for k in b:
    for row in A:
        for elem in row:
            if k == elem:
                elem = 0


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


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

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

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

print('No')

Submission status: Wrong Answer

Solution code:
a1j=list(map(int,input().split()))
a2j=list(map(int,input().split()))
a3j=list(map(int,input().split()))
n = int(input())

for i in range(n):
    b = int(input())
    if b in a1j:
        a1j[a1j.index(b)] = 0
    if b in a2j:
        a2j[a2j.index(b)] = 0
    if b in a3j:
        a3j[a3j.index(b)] = 0

ans = "No"

if a1j[0] == 0:
    if a1j[1] == 0 and a1j[2] == 0:
        ans = "Yes"
    if a2j[1] == 0 and a3j[2] == 0:
        ans = "Yes"
    if a2j[0] == 0 and a3j[0] == 0:
        ans = "Yes"
elif a1j[1] == 0:
    if a2j[1] == 0 and a3j[1] == 0:
        ans = "Yes"
elif a1j[2] == 0:
    if a2j[2] == 0 and a3j[2] == 0:
        ans = "Yes"
    if a2j[1] == 0 and a3j[0] == 0:
        ans = "Yes"
elif a2j[0] == 0:
    if a2j[1] == 0 and a2j[2] == 0:
        ans = "Yes"
elif a3j[0] == 0:
    if a3j[1] == 0 and a3j[2] == 0:
        ans = "Yes"

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys

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

for k in b:
    for row in A:
        for elem in row:
            if k == elem:
                elem = 0


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


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

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

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

print('No')

Submission status: Wrong Answer

Solution code:
a1j=list(map(int,input().split()))
a2j=list(map(int,input().split()))
a3j=list(map(int,input().split()))
n = int(input())

for i in range(n):
    b = int(input())
    if b in a1j:
        a1j[a1j.index(b)] = 0
    if b in a2j:
        a2j[a2j.index(b)] = 0
    if b in a3j:
        a3j[a3j.index(b)] = 0

ans = ""

if a1j[0] == 0:
    if a1j[1] == 0 and a1j[2] == 0:
        ans = "Yes"
    if a2j[1] == 0 and a3j[2] == 0:
        ans = "Yes"
    if a2j[0] == 0 and a3j[0] == 0:
        ans = "Yes"
elif a1j[1] == 0:
    if a2j[1] == 0 and a3j[1] == 0:
        ans = "Yes"
elif a1j[2] == 0:
    if a2j[2] == 0 and a3j[2] == 0:
        ans = "Yes"
    if a2j[1] == 0 and a3j[0] == 0:
        ans = "Yes"
elif a2j[0] == 0:
    if a2j[1] == 0 and a2j[2] == 0:
        ans = "Yes"
elif a3j[0] == 0:
    if a3j[1] == 0 and a3j[2] == 0:
        ans = "Yes"
else:
    ans = "No"

print(ans)

Submission status: Wrong Answer

Solution code:
def hasTri(arrs):
    k = [arrs[0][0], arrs[1][1], arrs[2][2]]
    l = [arrs[2][0], arrs[2][2], arrs[2][0]]
    if not False in k:
        return True
    if not False in l:
        return True
    return False
def hascol(arrs):
    for i in range(3):
        k = [arrs[0][i], arrs[1][i], arrs[2][i]]
        if not False in k:
            return True
    return False
def hasrow(arrs):
    for i in arrs:
        arr = [x for x in i if x != False]
        if len(arr)==3:
            return True
    return False
A = [[0,0,0],[0,0,0],[0,0,0]]
B = [[False,False,False],[False,False,False],[False,False,False]]
for i in range(3):
    A[i][0],A[i][1],A[i][2] = map(int, input().split())
N = int(input())
Al = [i for x in A for i in x]
have = []
for _ in range(N):
    a = int(input())
    if a in Al:
        have.append(a)
indexs = [[]]
for k in have:
    index = [[ix,iy] for ix, row in enumerate(A) for iy, j in enumerate(row) if j == k]
    if len(index[0]) == 2:
        indexs = indexs + index
        B[index[0][0]][index[0][1]] = k
if hasTri(B) or hasrow(B ) or hascol(B):
    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())
b=[]
for i in range(n):
    b.append(int(input()))
for j in range(3):
    for k in range(3):
        if a[j][k] == b:
            a[j][k] = 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[2][0]==a[1][1]==a[0][2]==0:
    ans='Yes'
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

a = []
ans = 'No'

a.append(list(map(int,input().split())))
a.append(list(map(int,input().split())))
a.append(list(map(int,input().split())))

n = int(input())

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
bingo=[list(map(int,input().split())) for i in range(3)]
n=int(input())
ans="No"
tmp1=0
tmp2=0
tmp3=0
tmp4=0
for i in range(n):
    tmp1=int(input())
    for j in range(3):
        for k in range(3):
            if bingo[j][k]==tmp1:
                bingo[j][k]=0
for l in range(3):
    for m in range(3):
        tmp2+=bingo[l][m]
    if tmp2==0:
        ans="Yes"
for n in range(3):
    for o in range(3):
        tmp3+=bingo[o][n]
    if tmp3==0:
        ans="Yes"
for p in range(3):
    tmp4+=bingo[p][p]
if tmp4==0:
    ans="Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
def row_sums(B):
    return sum(B[0])==0 or sum(B[1])==0 or sum(B[2]) == 0

def diagonal_sum(M):
    i,j = -1,-1
    sums = 0
    for _ in range(3):
        i += 1
        j += 1
        sums += M[i][j]
    return  sums == 0

def column_sum(M):
    columns = list(zip(*M))
    return row_sums(columns)

has = [[int(x) for x in input().split()] for _ in range(3)]
calls = int(input())
for _ in range(calls):
    current = int(input())
    for i in range(3):
        if current in has[i]:
            has[i][has[i].index(current)]=0
#print(has)
'''
if row_sums(has) or column_sum(has) or diagonal_sum(has):
    print('Yes')
else:print('No')
'''
answer = "NO"
for i in range(3):
    if has[i][0]==has[i][1]==has[i][2]==0:ans="Yes"
    if has[0][i]==has[1][i]==has[2][i]==0:ans="Yes"
if has[0][0]==has[1][1]==has[2][2]==0:ans="Yes"
if has[2][0]==has[1][1]==has[0][2]==0:ans="Yes"
print(answer)

Submission status: Wrong Answer

Solution code:
def row_sums(B):
    return sum(B[0])==0 or sum(B[1])==0 or sum(B[2]) == 0

def diagonal_sum(M):
    i,j = -1,-1
    sums = 0
    for _ in range(3):
        i += 1
        j += 1
        sums += M[i][j]
    return  sums == 0

def column_sum(M):
    columns = list(zip(*M))
    return row_sums(columns)






has = [[int(x) for x in input().split()] for _ in range(3)]
calls = int(input())
for _ in range(calls):
    current = int(input())
    for i in range(3):
        if current in has[i]:
            has[i][has[i].index(current)]=0
#print(has)
if row_sums(has) or column_sum(has) or diagonal_sum(has):
    print('Yes')
else:print('No')

Submission status: Wrong Answer

Solution code:
bingo = [input().split() for _ in range(3)]

n = int(input())

nums = [[] for _ in range(3)]

check = [[] for _ in range(3)]

for i in range(3):
    for j in range(3):
        check[i].append(False)
        if bingo[i][j] in nums:
            check[i][j] = True

ANS = "No"

for i in range(3):
    if (check[i][0]) and (check[i][1]) and (check[i][2]):
        ANS = "Yes"
for i in range(3):
    if (check[0][i]) and (check[1][i]) and (check[2][i]):
        ANS = "Yes"
if (check[0][0]) and (check[1][1]) and (check[2][2]):
    ANS = "Yes"
if (check[0][2]) and (check[1][1]) and (check[2][0]):
    ANS = "Yes"

print(ANS)

Submission status: Wrong Answer

Solution code:
import numpy as np
A = np.array([list(map(int,input().split())) for i in range(3)])
N = int(input())
b = [int(input()) for i in range(N)]
B = np.array([[0]*3 for i in range(3)])
for _ in b:
    for t in range(3):
        for y in range(3):
            if A[t][y] == _:
                B[t][y] = 1
ans = "No"
for i in range(3):
    if all(A[i] == [1,1,1]):
        ans ="Yes"
    if all(A[:,i] == [1,1,1]):
        ans ="Yes"
if A[0,0] == 1 and A[1,1] == 1 and A[2,2] == 1:
    ans ="Yes"
if A[2,0] == 1 and A[1,1] == 1 and A[0,2] == 1:
    ans ="Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
a = [input().split() for a in range(3)]
a1 = [a[0][0],a[0][1],a[0][2]]
a2 = [a[1][0],a[1][1],a[1][2]]
a3 = [a[2][0],a[2][1],a[2][2]]
a4 = [a[0][0],a[1][1],a[2][2]]
a5 = [a[0][2],a[1][1],a[2][0]]
a6 = [a[0][0],a[1][0],a[2][0]]
a7 = [a[0][1],a[1][1],a[2][1]]
a8 = [a[0][2],a[1][2],a[2][2]]
n = int(input())
B = [int(input()) for i in range(n)]
if set(a1) <= set(B) or set(a2) <= set(B) or set(a3) <= set(B) or set(a4) <= set(B) or set(a5) <= set(B) or set(a6) <= set(B) or set(a7) <= set(B) or set(a8) <= set(B):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
A = [list(map(int,input().split())) for i in range(3)]
for i in range(int(input())):
  b = int(input())
  for j in range(3):
    for k in range(3):
      if A[j][k] == b:
        A[j][k] = 'check'
if A[0][0] == A[0][1] == A[0][2]:
  print('Yes')
elif A[1][0] == A[1][1] == A[1][2]:
  print('Yes')
elif A[2][0] == A[2][1] == A[2][2]:
  print('Yes')
elif A[0][0] == A[0][1] == A[0][2]:
  print('Yes')
elif A[1][0] == A[1][1] == A[1][2]:
  print('Yes')
elif A[2][0] == A[2][1] == A[2][2]:
  print('Yes')
elif A[0][0] == A[1][1] == A[2][2]:
  print('Yes')
elif A[2][0] == A[1][1] == A[0][2]:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
a = [input().split() for a in range(3)]
a1 = [a[0][0],a[0][1],a[0][2]]
a2 = [a[1][0],a[1][1],a[1][2]]
a3 = [a[2][0],a[2][1],a[2][2]]
a4 = [a[0][0],a[1][1],a[2][2]]
a5 = [a[0][2],a[1][1],a[2][0]]
a6 = [a[0][0],a[1][0],a[2][0]]
a7 = [a[1][0],a[1][1],a[2][1]]
a8 = [a[2][0],a[2][1],a[2][2]]
n = int(input())
B = [int(input()) for i in range(n)]
if set(a1) <= set(B) or set(a2) <= set(B) or set(a3) <= set(B) or set(a4) <= set(B) or set(a5) <= set(B) or set(a6) <= set(B) or set(a7) <= set(B) or set(a8) <= set(B):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

if A[0][0] == 0 and A[1][1] ==0 and A[2][2]==0:
  print("Yes")
  sys.exit(0)
elif A[0][2]==0 and A[1][1]==0 and A[2][0]==0:
  print("Yes")
  sys.exit(0)
for i in range(3):
  for j in range(3):
    if A[i][j]==0:
      if i!=2:
        continue
      else:
        print("Yes")
        sys.exit(0)

for i in range(3):
  for j in range(3):
    if A[j][i]==0:
      if i!=2:
        continue
      else:
        print("Yes")
        sys.exit(0)

print("No")

Submission status: Wrong Answer

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

if A[0][0] == 0 and A[1][1] ==0 and A[2][2]==0:
  print("Yes")
  sys.exit(0)
elif A[0][2]==0 and A[1][1]==0 and A[2][0]==0:
  print("Yes")
  sys.exit(0)
for i in range(3):
  for j in range(3):
    if A[i][j]==0:
      if i!=2:
        continue
      else:
        print("Yes")
        sys.exit(0)
    else:
      break
for i in range(3):
  for j in range(3):
    if A[j][i]==0:
      if i!=2:
        continue
      else:
        print("Yes")
        sys.exit(0)
    else:
      break
print(A)
print("No")

Submission status: Wrong Answer

Solution code:
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
a3 = list(map(int,input().split()))
a4 = set()
a5 = set()
a6 = set()
a7 = set()
a8 = set()
a4.update({a1[0],a2[1],a3[2]})
a5.update({a1[2],a2[1],a3[0]})
a6.update({a1[0],a1[1],a1[2]})
a7.update({a2[0],a2[1],a2[2]})
a8.update({a3[0],a3[1],a3[2]})
n = int(input())
B =set()
for i in range(n):
    b = int(input())
    B.add(b)
if set(a1) <= B or set(a2) <= B or set(a3) <= B or a4 <= B or a5 <= B or a6 <= B or a7 <= B or a8 <= B:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
a3 = list(map(int,input().split()))
a4 = set()
a5 = set()
a4.update({a1[0],a2[1],a3[2]})
a5.update({a1[2],a2[1],a3[0]})
n = int(input())
B =set()
for i in range(n):
    b = int(input())
    B.add(b)
if set(a1) <= B or set(a2) <= B or set(a3) <= B or a4 <= B or a5 <= B:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
a3 = list(map(int,input().split()))
a4 = set()
a5 = set()
a4.update({a1[0],a2[1],a3[2]})
a5.update({a1[2],a2[1],a3[0]})
print(a4)
print(a5)
n = int(input())
B =set()
for i in range(n):
    b = int(input())
    B.add(b)
if set(a1) <= B or set(a2) <= B or set(a3) <= B or a4 <= B or a5 <= B:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
a = [input().split() for l in range(3)]
a = [[int(item) for item in row] for row in a]
N = int(input())
b = [input() for i in range(N)]
A = [[0,0,0],[0,0,0],[0,0,0]]
x = 0
for i in range(N):
  for j in range(3):
    for k in range(3):
      if a[j][k] == b[i]:
        A[j][k] = 1
for i in range(3):
  if A[i][0]*A[i][1]*A[i][2] == 1 | A[0][i]*A[1][i]*A[2][i] == 1:
    x = 1
if A[0][0]*A[1][1]*A[2][2] == 1 | A[0][2]*A[1][1]*A[2][0] == 1:
  x = 1
if x:
  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 = []
for i in range(N):
  B.append(int(input()))

for b in B:
  for i in range(3):
    for j in range(3):
      if A[i][j] == b:
        A[i][j] = 0
f = False
for i in range(3):
  s = 0
  for j in range(3):
    s += A[i][j]
  if s == 0:
    f = True
for i in range(3):
  s = 0
  for j in range(3):
    s += A[j][i]
  if s == 0:
    f = True
s = 0
for i in range(3):
  s += A[i][i]
  if s == 0:
    f = True
s = 0
for i in range(3):
  s += A[i][2-i]
  if s == 0:
    f = True
print('Yes' if f else 'No')

Submission status: Wrong Answer

Solution code:
a = [input().split() for l in range(3)]
a = [[int(item) for item in row] for row in a]
N = int(input())
b = [input() for i in range(N)]
A = [[1,1,1],[1,1,1],[1,1,1]]
x = 1
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
for i in range(3):
  if A[i][0]*A[i][1]*A[i][2] == 0 | A[0][i]*A[1][i]*A[2][i] == 0:
    x = 0
if A[0][0]*A[1][1]*A[2][2] == 0 | A[0][2]*A[1][1]*A[2][0] == 0:
  x = 0
if x:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
a = [input().split() for l in range(3)]
a = [[int(item) for item in row] for row in a]
N = int(input())
b = [input() for i in range(N)]
x = 1
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
for i in range(3):
  if a[i][0]*a[i][1]*a[i][2] == 0 | a[0][i]*a[1][i]*a[2][i] == 0:
    x = 0
if a[0][0]*a[1][1]*a[2][2] == 0 | a[0][2]*a[1][1]*a[2][0] == 0:
  x = 0
if x:
  print('No')
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
import numpy as np
A = []
marubatsu = np.zeros((3,3),dtype=int)

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

for i in lott:
    for j in range(3):
        for k in range(3):
            if A[j][k] == i:
                marubatsu[j,k] = 1
                break
            else:
                continue
            break
        
def bingo_tate_yoko(marubatsu):
    for i in range(3):
        if np.sum(marubatsu, axis=0)[i] == 3 or np.sum(marubatsu, axis=0)[i] == 3:
            return(1)
            break
        elif i == 2:
            return(0)

def bingo_naname(marubatsu):
    if marubatsu[0,0]+marubatsu[1,1]+marubatsu[2,2] == 3 or marubatsu[0,2]+marubatsu[1,1]+marubatsu[2,0] == 3:
        return(1)
    else:
        return(0)

if bingo_tate_yoko(marubatsu) == 1:
    print('Yes')
elif bingo_naname(marubatsu) == 1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
a = [input().split() for l in range(3)]
n = int(input())
b = [input() for i in range(n)]
c = [a[0][0],a[1][1],a[2][2]]
d = [a[0][2],a[1][1],a[2][0]]
tate1 = len(set(a[0]) & set(b))
tate2 = len(set(a[1]) & set(b))
tate3 = len(set(a[2]) & set(b))
yoko1 = len(set([x[0] for x in a]) & set(b))
yoko2 = len(set([x[1] for x in a]) & set(b))
yoko3 = len(set([x[2] for x in a]) & set(b))
naname1 = len(set(c) & set(b))
naname2 = len(set(d) & set(b))
bingo = [tate1,tate2,tate3,yoko1,yoko2,yoko3,naname1,naname2]
if 3 in bingo:
  print("bingo")
else:
  print("NG")

Submission status: Wrong Answer

Solution code:
import numpy as np
A = []
marubatsu = np.zeros((3,3),dtype=int)

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

for i in lott:
    for j in range(3):
        for k in range(3):
            if A[j][k] == i:
                marubatsu[j,k] = 1
                break
            else:
                continue
            break
        
def bingo_tate_yoko(marubatsu):
    for i in range(3):
        if np.sum(marubatsu, axis=0)[i] == 3 or np.sum(marubatsu, axis=0)[i] == 3:
            return(1)
        else:
            return(0)

def bingo_naname(marubatsu):
    if marubatsu[0,0]+marubatsu[1,1]+marubatsu[2,2] == 3 or marubatsu[0,2]+marubatsu[1,1]+marubatsu[2,0] == 3:
        return(1)
    else:
        return(0)

if bingo_tate_yoko(marubatsu) == 1:
    print('Yes')
elif bingo_naname(marubatsu) == 1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
a = [input().split() for l in range(3)]
print(a)
n = int(input())
print(n)
b = [input() for i in range(n)]
print(b)
c = [a[0][0],a[1][1],a[2][2]]
d = [a[0][2],a[1][1],a[2][0]]
tate1 = len(set(a[0]) & set(b))
tate2 = len(set(a[1]) & set(b))
tate3 = len(set(a[2]) & set(b))
yoko1 = len(set([x[0] for x in a]) & set(b))
yoko2 = len(set([x[1] for x in a]) & set(b))
yoko3 = len(set([x[2] for x in a]) & set(b))
naname1 = len(set(c) & set(b))
naname2 = len(set(d) & set(b))
bingo = [tate1,tate2,tate3,yoko1,yoko2,yoko3,naname1,naname2]
if 3 in bingo:
  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=[int(input()) for _ in range(n)]
maze=[["*" for i in range(3)] for _ in range(3)]
for i in range(n):
    for j in range(3):
        for k in range(3):
            if b[i]==a[j][k]:
                maze[j][k]="#"
for i in range(3):
    f=1
    for j in range(3):
        if maze[i][j]!="#":
            f=0
            break
    if f:
        print("Yes")
        exit()
for i in range(3):
    fa=1
    if maze[i][i]!="#":
        fa=0
        break
if fa:
    print("Yes")
    exit()
for i in range(3):
    fe=1
    if maze[i][2-i]!="#":
        fe=0
        break
if fe:
    print("Yes")
    exit()
print("No")

Submission status: Wrong Answer

Solution code:
a = [[int(i) for i in input().split()] for _ in range(3)]
appear = [[False] * 3] * 3
print("appear", appear)
for i in range(int(input())):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k] == b:
                appear[j][k] = True

ans = "No"
for i in range(3):
    if appear[i][0] == appear[i][1] == appear[i][2] == True:
        ans = "Yes"
    if appear[0][i] == appear[1][i] == appear[2][i] == True:
        ans = "Yes"
if appear[0][0] == appear[1][1] == appear[2][2] == True:
    ans = "Yes"
if appear[2][0] == appear[1][1] == appear[0][2] == True:
    ans = "Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
a = [[int(i) for i in input().split()] for _ in range(3)]
appear = [[False] * 3] * 3
print("appear", appear)
for i in range(int(input())):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k] == b:
                appear[j][k] = True

ans = "No"
for i in range(3):
    if appear[i][0] == appear[i][1] == appear[i][2]:
        ans = "Yes"
    if appear[0][i] == appear[1][i] == appear[2][i]:
        ans = "Yes"
if appear[0][0] == appear[1][1] == appear[2][2]:
    ans = "Yes"
if appear[2][0] == appear[1][1] == appear[0][2]:
    ans = "Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
a = [[int(i) for i in input().split()] for _ in range(3)]
appear = [[False] * 3] * 3
for i in range(int(input())):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k] == b:
                appear[j][k] = True

ans = "No"
for i in range(3):
    if appear[i][0] and appear[i][1] and appear[i][2]:
        ans = "Yes"
    if appear[0][i] and appear[1][i] and appear[2][i]:
        ans = "Yes"
if appear[0][0] and appear[1][1] and appear[2][2]:
    ans = "Yes"
if appear[2][0] and appear[1][1] and appear[0][2]:
    ans = "Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
a = [[int(i) for i in input().split()] for _ in range(3)]
n = int(input())
appear = [[False] * 3] * 3
for i in range(n):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k] == b:
                appear[j][k] = True

ans = "No"
for i in range(3):
    if appear[i][0] and appear[i][1] and appear[i][2]:
        ans = "Yes"
for i in range(3):
    if appear[0][i] and appear[1][i] and appear[2][i]:
        ans = "Yes"
if appear[0][0] and appear[1][1] and appear[2][2]:
    ans = "Yes"
if appear[0][2] and appear[1][1] and appear[2][0]:
    ans = "Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
a1 = [int(i) for i in input().split()]
a2 = [int(i) for i in input().split()]
a3 = [int(i) for i in input().split()]
a = [a1, a2, a3]
n = int(input())
b = [0] * 10
for i in range(n):
    b[i] = int(input())

appear = [[False] * 3] * 3
for i in range(3):
    for j in range(3):
        for k in range(n):
            if a[i][j] == b[k]:
                appear[i][j] = True

ans = "No"
for i in range(3):
    if appear[i][0] and appear[i][1] and appear[i][2]:
        ans = "Yes"
for i in range(3):
    if appear[0][i] and appear[1][i] and appear[2][i]:
        ans = "Yes"
if (
    appear[0][0]
    and appear[1][1]
    and appear[2][2]
    or appear[0][2]
    and appear[1][1]
    and appear[2][0]
):
    ans = "Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
bingo = []

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

n = int(input())

nums = []

for i in range(n):
    nums.append(int(input()))

for i in nums:
    for j in range(3):
        if i in bingo[j]:
            bingo[j][bingo[j].index(i)] = 0

success = 0

# 行列入れ替え
bingo_t = [x for x in zip(*bingo)]

for i in range(3):
    count = 0
    for j in range(3):
        if bingo[i][j] == 0:
            count += 1
    if count == 3:
        success += 1
        break
    for j in range(3):
        if bingo_t[j][i] == 0:
            count += 1
    if count == 3:
        success += 1
        break

dia1 = bingo[0][0] + bingo[1][1] + bingo[2][2]
dia2 = bingo[-1][0] + bingo[-2][1] + bingo[-3][2]

if (dia1 == 0) or (dia2 == 0):
    success += 1

print("Yes" if success > 0 else "No")

Submission status: Wrong Answer

Solution code:
a=open(0).read().split();print('YNeos'[all(t-set(map(a.index,a[10:]))for t in({0,3,6},{0,4,8},{2,4,6},{2,5,8},{3,4,5}))::2])

Submission status: Wrong Answer

Solution code:
a=open(0).read().split();print('YNeos'[all(t-set(map(a.index,a[10:]))for t in({0,3,6},{0,4,8},{2,4,6},{2,5,8},{6,7,8}))::2])

Submission status: Wrong Answer

Solution code:
a=open(0).read().split();print('YNeos'[all(t-set(map(a.index,a[10:]))for t in({0,3,6},{0,4,8},{2,4,6},{3,4,5},{6,7,8}))::2])

Submission status: Wrong Answer

Solution code:
a=open(0).read().split();print('YNeos'[all(t-set(map(a.index,a[10:]))for t in({0,3,6},{0,4,8},{2,5,8},{3,4,5},{6,7,8}))::2])

Submission status: Wrong Answer

Solution code:
a=open(0).read().split();print('YNeos'[all(t-set(map(a.index,a[10:]))for t in({0,4,8},{1,4,7},{2,4,6},{2,5,8},{3,4,5},{6,7,8}))::2])

Submission status: Wrong Answer

Solution code:
ansList = [[0] * 3 for i in range(3)]
a_i = []
for x in range(3):
    a_i.append(list(map(int, input().split())))
n = int(input())
for x in range(n):
    val = int(input())
    for id in range(3):
        if(val in a_i[id]): 
            ansList[id][a_i[id].index(val)] = 1
            break
#横
if(ansList[0][0] == 1 and ansList[0][1] == 1 and ansList[0][2] == 1): print("Yes")
elif(ansList[1][0] == 1 and ansList[1][1] == 1 and ansList[1][2] == 1): print("Yes")
elif(ansList[2][0] == 1 and ansList[2][1] == 1 and ansList[2][2] == 1): print("Yes")
#縦
elif(ansList[0][0] == 1 and ansList[0][0] == 1 and ansList[0][0] == 1): print("Yes")
elif(ansList[0][1] == 1 and ansList[0][1] == 1 and ansList[0][1] == 1): print("Yes")
elif(ansList[0][2] == 1 and ansList[0][2] == 1 and ansList[0][2] == 1): print("Yes")
#ななめ
elif(ansList[0][0] == 1 and ansList[1][1] == 1 and ansList[2][2] == 1): print("Yes")
elif(ansList[0][2] == 1 and ansList[1][1] == 1 and ansList[2][0] == 1): print("Yes")
else: print("No")