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:
def Judge(a):
  col=[]
  diag1=0
  diag2=0

  for i in range(3):
    if(a[i].count(0)==3):
      return 1
      break
    if(a[0][i]==0):
      col.append(0)
    if(a[1][i]==0):
      col.append(1)
    if(a[2][i]==0):
      col.append(2)
    if(a[i][i]==0):
      diag1+=1
    if(a[i][-(i+1)]==0):
      diag2+=1
  if(diag1==3 or diag2==3):
    return 1
  if(col.count(0)==3 or col.count(1)==3 or col.count(2)==3):
    return 1
  return 0


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):
    for k in range(3):
      if(b==a[j][k]):
        a[j][k]=0
judge=Judge(a)
if(judge==1):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
lst = [ [ int(i) for i in input().split() ] for j in range(3) ]

n = int(input())

for _ in range(n):
  x = int(input())
  for d in lst:
    if d[0] == x:
      d[0] = -1
    elif d[1] == x:
      d[1] = -1
    elif d[2] == x:
      d[2] = -1
print(lst)
for d in lst:
  if d[0] == d[1] == d[2] == -1:
    print('Yes')
    exit()
for i in range(3):
  if lst[0][i] == lst[1][i] == lst[2][i] == -1:
    print('Yes')
    exit()
for i in range(3):
  if lst[i][0] == lst[i][1] == lst[i][2] == -1:
    print('Yes')
    exit()
if lst[0][0] == lst[1][1] == lst[2][2] == -1:
  print('Yes')
  exit()
if lst[0][2] == lst[1][1] == lst[2][0] == -1:
  print('Yes')
  exit()
print('No')

Submission status: Wrong Answer

Solution code:
lst = [ [ int(i) for i in input().split() ] for j in range(3) ]

n = int(input())

for _ in range(n):
  x = int(input())
  for d in lst:
    if d[0] == x:
      d[0] = -1
    elif d[1] == x:
      d[1] = -1
    elif d[2] == x:
      d[2] = -1
for d in lst:
  if d[0] == d[1] == d[2] == -1:
    print('Yes')
    exit()
    
for i in range(3):
  if lst[i][0] == lst[i][1] == lst[i][2] == -1:
    print('Yes')
    exit()
if lst[0][0] == lst[1][1] == lst[2][2] == -1:
  print('Yes')
  exit()
if lst[0][2] == lst[1][1] == lst[2][0] == -1:
  print('Yes')
  exit()
print('No')

Submission status: Wrong Answer

Solution code:
lst = [ [ int(i) for i in input().split() ] for j in range(3) ]

n = int(input())

for _ in range(n):
  x = int(input())
  for d in lst:
    if d[0] == x:
      d[0] = -1
    elif d[1] == x:
      d[1] = -1
    elif d[2] == x:
      d[2] = -1
for d in lst:
  if d[0] == d[1] == d[2] == -1:
    print('Yes')
    exit()
    
for i in range(3):
  if lst[i][0] == lst[i][1] == lst[i][2] == -1:
    print('Yes')
    exit()
if lst[0][0] == lst[1][1] == lst[2][2] == -1:
  print('Yes')
  exit()
if lst[0][2] == lst[1][1] == lst[2][0] == -1:
  print('Yes')
  exit()
print()

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)]
used=[[False]*3 for _ in range(3)]
for k in range(n):
    for i in range(3):
        for j in range(3):
            if a[i][j]==b[k]:
                used[i][j]==True

for i in range(3):
    if used[0][i] and used[1][i] and used[2][i]:
        print("Yes")
        exit()
        
for i in range(3):
    if used[i][0] and used[i][1] and used[i][2]:
        print("Yes")
        exit()

if used[0][0] and used[1][1] and used[2][2]:
        print("Yes")
        exit()

if used[0][2] and used[1][1] and used[2][0]:
        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=[int(input()) for _ in range(n)]
used=[[False]*3 for _ in range(3)]
for k in range(n):
    for i in range(3):
        for j in range(3):
            if a[i][j]==b[k]:
                used[i][j]==True

for i in range(3):
    if used[0][i]==used[1][i]==used[2][i]:
        print("Yes")
        exit()
        
for i in range(3):
    if used[i][0]==used[i][1]==used[i][2]:
        print("Yes")
        exit()

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

if used[0][2]==used[1][1]==used[2][0]:
        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=[int(input()) for _ in range(n)]
used=[[False]*3 for _ in range(3)]
for k in range(n):
    for i in range(3):
        for j in range(3):
            if a[i][j]==b[k]:
                used[i][j]==True

for i in range(3):
    if a[0][i]==a[1][i]==a[2][i]:
        print("Yes")
        exit()
        
for i in range(3):
    if a[i][0]==a[i][1]==a[i][2]:
        print("Yes")
        exit()

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

if 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)]
n=int(input())
b=[int(input()) for _ in range(n)]
used=[[False]*3 for _ in range(3)]
for k in range(n):
    for i in range(3):
        for j in range(3):
            if a[i][j]==b[k]:
                used[i][j]==True

for i in range(3):
    if a[0][i]==a[1][i]==a[2][i]:
        print("Yes")
        exit()
        
for i in range(3):
    if a[i][0]==a[i][1]==a[i][2]:
        print("Yes")
        exit()

for i in range(3):
    if a[0][0]==a[1][1]==a[2][2]:
        print("Yes")
        exit()

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

Submission status: Wrong Answer

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

for b in B:
    tmp=[i for i,x in enumerate(A) if x==b]
    for t in tmp:
        table[t//3][t%3]=1

flag=False
n1,n2=0,0
for i in range(3):
    if sum(table[i])==3: flag=True
    if sum([table[i][j] for j in range(3)])==3: flag=True
    n1+=table[i][i]
    n2+=table[i][2-i]
if n1==3 or n2==3: flag=True

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

Submission status: Wrong Answer

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

for b in B:
    if b in A:
        tmp=A.index(b)
        table[tmp//3][tmp%3]=1

flag=False
n1,n2=0,0
for i in range(3):
    if sum(table[i])==3: flag=True
    if sum([table[i][j] for j in range(3)])==3: flag=True
    n1+=table[i][i]
    n2+=table[i][2-i]
if n1==3 or n2==3: flag=True

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

Submission status: Wrong Answer

Solution code:
sheet = []

for i in range(3):
  d = list(map(int, input().split()))
  sheet.append(d)
  
N = int(input())

A = [[0,0,0],[0,0,0],[0,0,0]]

for i in range(N):
  d = int(input())
  for j in range(3):
    if d in sheet[j]:
      m = sheet[j].index(d)
      A[j][m] = 1

B = 0

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

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

bb = 0
for i in range(3):
  if A[i][i] == 1:
    bb += 1
if bb == 3:
  B = 1

bb = 0
for i in range(3):
  if A[2-i][i] == 1:
    bb += 1
if bb == 3:
  B = 1

if B == 1:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
sheet = []

for i in range(3):
  d = list(map(int, input().split()))
  sheet.append(d)
  
N = int(input())

A = [[0,0,0],[0,0,0],[0,0,0]]

for i in range(N):
  d = int(input())
  for j in range(3):
    if d in sheet[j]:
      m = sheet[j].index(d)
      A[j][m] = 1

B = 0

for i in range(3):
  if A[i].count(1) == 3:
    B = 1

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

bb = 0
for i in range(3):
  if A[i][i] == 1:
    bb += 1
if bb == 3:
  B = 1

bb = 0
for i in range(3):
  if A[2-i][i] == 1:
    bb += 1
if bb == 3:
  B = 1

if B == 1:
  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())
b = list(int(input()) for _ in range(n))
for i in range(3) :
    for j in range(3) :
        for k in range(n) :
            if l[i][j] == b[k] :
                l[i][j] = 0

for i in range(2) :
    if l[i][0] + l[i][1] + l[i][2] == 0 :
        print('Yes')
        exit()
    if l[0][i] + l[1][i] + l[2][i] == 0 :
        print('Yes')
        exit()
    if l[0][0] + l[1][1] + l[2][2] == 0 :
        print('Yes')
        exit()
    if  l[0][2] + l[1][1] + l[2][0] == 0 :
        print('Yes')
        exit()
print('No')

Submission status: Wrong Answer

Solution code:
a=[]
for i in range(3):
  da=list(map(int,input().split()))
  for j in da:
    a.append(j)
n=int(input())
for i in range (n):
  b=int(input())
  for j in range(len(a)):
    if a[j] == b:
      a[j]=0

for i in range (2):
  if a[i] == a[i+3] and a[i+3]==a[i+6]:
    print('Yes')
    exit()
for i in range(2):
  if a[3*i]==a[3*i+1] and a[3*i]==a[3*i+2]:
    print('Yes')
    exit() 
if a[0]==a[4] and a[0]==a[8]:
  print('Yes')
  exit()

if a[2]==a[4] and a[2]==a[6]:
  print('Yes')
  exit()
print('No')

Submission status: Wrong Answer

Solution code:
a=[]
for i in range(3):
  da=list(map(int,input().split()))
  for j in da:
    a.append(j)
n=int(input())
for i in range (n):
  b=int(input())
  for j in range(len(a)):
    if a[j] == b:
      a[j]=0

for i in range (2):
  if a[i] == a[i+3] and a[i+3]==a[i+6]:
    print('Yes')
    exit()
for i in range(2):
  if a[3*i]==a[3*i+1] and a[3*i]==a[3*i+2]:
    print('Yes')
    exit() 
if a[0]==a[4] and a[0]==a[8]:
  print('Yes')
  exit()

if a[2]==a[4] and a[2]==a[6]:
  print('Yes')
  exit()

Submission status: Wrong Answer

Solution code:
array = [ list(map(int,input().split())) for _ in range(3) ]
number = []
N = int(input())
for _ in range(N):
  number += [ int(input()) ]
for i in range(3):
  for t in range(3):
    if array[i][t] in number:
      array[i][t] = 0
for i in range(1):
  if array[i][0] == array[i+1][0] == array[i+2][0]:
    print('Yes')
    exit()
  elif array[i][1] == array[i+1][1] == array[i+2][1]:
    print('Yes')
    exit()
  elif array[i][2] == array[i+1][2] == array[i+2][2]:
    print('Yes')
    exit()
  elif array[i][0] == array[i][1] == array[i][2] or array[i+1][0] == array[i+1][1] == array[i+1][2] or array[i+2][0] == array[i+2][1] == array[i+2][2]:
    print('Yes')
    exit()
if array[0][0] == array[1][1] == array[2][2] or array[0][2] == array[1][1] == array[2][0]:
  print('Yes')
else:
  print('No')
print(array)

Submission status: Wrong Answer

Solution code:
array = [ list(map(int,input().split())) for _ in range(3) ]
number = []
N = int(input())
for _ in range(N):
  number += [ int(input()) ]
for i in range(3):
  for t in range(3):
    if array[i][t] in number:
      array[i][t] = 0
for i in range(1):
  if array[i][0] == array[i+1][0] == array[i+2][0]:
    print('Yes')
    exit()
  elif array[i][1] == array[i+1][1] == array[i+2][1]:
    print('Yes')
    exit()
  elif array[i][2] == array[i+1][2] == array[i+2][2]:
    print('Yes')
    exit()
if array[0][0] == array[1][1] == array[2][2] or array[0][2] == array[1][1] == array[2][0]:
  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=[int(input()) for i 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]=-1
if A[0][0]==-1 and A[1][1]==-1 and A[2][2]==-1:
    print("Yes")
    exit()
elif A[0][2]==-1 and A[1][1]==-1 and A[2][0]==-1:
    print("Yes")
    exit()

for i in range(3):
    total=0
    if A[i].count(-1)==3:
        print("Yes")
        exit()
    for j in range(3):
        if A[i][j]==-1:
            total+=1
    if total==3:
        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())
b=[int(input()) for i 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]=-1
if A[0][0]==-1 and A[1][1]==-1 and A[2][2]==-1:
    print("Yes")
    exit()
elif A[0][2]==-1 and A[1][1]==-1 and A[2][0]==-1:
    print("Yes")
    exit()
total=0
for i in range(3):
    if A[i].count(-1)==3:
        print("Yes")
        exit()
    for j in range(3):
        if A[i][j]==-1:
            total+=1
    if total==3:
        print("Yes")
        exit()
print("No")

Submission status: Wrong Answer

Solution code:
l = [ list(map(int,input().split(" "))) for i in range(3)]
n=int(input())
for i in range(n):
    b=int(input())
    for j in range(3):
        for k in range(3):
            if l[j][k]==b:
                l[j][k]=-1
if l[0][0]==-1 and l[0][1]==-1 and l[0][2]:
    print("Yes")
elif l[1][0]==-1 and l[1][1]==-1 and l[1][2]:
    print("Yes")
elif l[2][0]==-1 and l[2][1]==-1 and l[2][2]:
    print("Yes")
elif l[0][0]==-1 and l[1][0]==-1 and l[2][0]:
    print("Yes")
elif l[0][1]==-1 and l[1][1]==-1 and l[2][1]:
    print("Yes")
elif l[0][2]==-1 and l[1][2]==-1 and l[2][2]:
    print("Yes")
elif l[0][0]==-1 and l[1][1]==-1 and l[2][2]:
    print("Yes")
elif l[0][2]==-1 and l[1][1]==-1 and l[2][0]:
    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())
for i in range(n):
    b=int(input())
    for j in range(3):
        for k in range(3):
            if l[j][k]==b:
                l[j][k]=-1
if l[0][0]==-1 and l[0][1]==-1 and l[0][2]:
    print("Yes")
elif l[1][0]==-1 and l[1][1]==-1 and l[1][2]:
    print("Yes")
elif l[2][0]==-1 and l[2][1]==-1 and l[2][2]:
    print("Yes")
elif l[0][0]==-1 and l[1][0]==-1 and l[2][0]:
    print("Yes")
elif l[0][1]==-1 and l[1][1]==-1 and l[2][1]:
    print("Yes")
elif l[0][2]==-1 and l[1][2]==-1 and l[2][2]:
    print("Yes")
elif l[0][0]==-1 and l[1][1]==-1 and l[2][2]:
    print("Yes")
elif l[0][2]==-1 and l[1][1]==-1 and l[2][0]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

N=int(input())

list1=[int(input()) for _ in range(N)]

list2=[]
i=0
while i<=2:
    j=0
    while j<=2:
        list2.append(num_list[i][j])
        j=j+1
    i=i+1

s=0
for k in list2:
    if list1.count(k)==1:
        list2[s]=101
        s=s+1
    else:
        s=s+1
        continue

print(list2)

if list2[0]+list2[1]+list2[2]==303:
    print('Yes')
elif list2[3]+list2[4]+list2[5]==303:
    print('Yes')
elif list2[6]+list2[7]+list2[8]==303:
    print('Yes')
elif list2[0]+list2[3]+list2[6]==303:
    print('Yes')
elif list2[1]+list2[4]+list2[7]==303:
    print('Yes')
elif list2[2]+list2[5]+list2[8]==303:
    print('Yes')
elif list2[0]+list2[4]+list2[8]==303:
    print('Yes')
elif list2[2]+list2[4]+list2[6]==303:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

N=int(input())

list1=[int(input()) for _ in range(N)]

list2=[]
i=0
while i<=2:
    j=0
    while j<=2:
        list2.append(num_list[i][j])
        j=j+1
    i=i+1

s=0
for k in list2:
    if list1.count(k)==1:
        list2[s]=101
        s=s+1
    else:
        continue

if list2[0]+list2[1]+list2[2]==303:
    print('Yes')
elif list2[3]+list2[4]+list2[5]==303:
    print('Yes')
elif list2[6]+list2[7]+list2[8]==303:
    print('Yes')
elif list2[0]+list2[3]+list2[6]==303:
    print('Yes')
elif list2[1]+list2[4]+list2[7]==303:
    print('Yes')
elif list2[2]+list2[5]+list2[8]==303:
    print('Yes')
elif list2[0]+list2[4]+list2[8]==303:
    print('Yes')
elif list2[2]+list2[4]+list2[6]==303:
    print('Yes')
else:
    print('No')

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

Alist = []
Alist.append(A11)
Alist.append(A12)
Alist.append(A13)
Alist.append(A21)
Alist.append(A22)
Alist.append(A23)
Alist.append(A31)
Alist.append(A32)
Alist.append(A33)
bingolist =[0]*9

N = int(input())
#print (N)
for i in range(N):
  b = int(input())
  print (b)
  for j in range(len(bingolist)):
    if b ==Alist[j]:
      bingolist[j] = 1

if sum(bingolist[0:3])==3 or sum(bingolist[3:6])==3 or sum(bingolist[6:9])==3 or (bingolist[0]+bingolist[3]+bingolist[6])==3 or (bingolist[1]+bingolist[4]+bingolist[7])==3 or (bingolist[2]+bingolist[5]+bingolist[8])==3 or (bingolist[0]+bingolist[4]+bingolist[8])==3 or (bingolist[2]+bingolist[4]+bingolist[6])==3:
  print ("Yes")
else :
  print ("No")
#print (bingolist[0:3])
#print (bingolist[3:6])
#print (bingolist[6:9])
#print (bingolist)

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):
        if A[i][j] in B:
            A[i][j] = -1

for i in range(3):
    ans1, ans2 = 0, 0
    for j in range(3):
        if A[i][j] == -1:
            ans1 += 1
        if A[j][i] == -1:
            ans2 += 1
    if ans1 == 3 or ans2 == 3:
        print("Yes")
        exit()

if (A[0][0] == -1 and A[1][1] == -1 and A[2][2] == -1) or \
        (A[0][2] == -1 and A[1][1] != -1 and A[2][0] == -1):
    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)]

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

for i in range(3):
    ans1, ans2 = 0, 0
    for j in range(3):
        if A[i][j] == -1:
            ans1 += 1
        if A[j][i] == -1:
            ans2 += 1
    if ans1 == 3 or ans2 == 3:
        print("Yes")
        exit()

if (A[0][0] == -1 and A[1][1] == -1 and A[2][2] != -1) or \
        (A[0][2] == -1 and A[1][1] != -1 and A[2][0] != -1):
    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)]

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

for i in range(3):
    ans1, ans2 = 0, 0
    for j in range(3):
        if A[i][j] == -1:
            ans1 += 1
        if A[j][i] == -1:
            ans2 += 1
    if ans1 == 3 or ans2 == 3:
        print("Yes")
        exit()

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

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):
        if A[i][j] in B:
            A[i][j] = -1

for i in range(3):
    ans1, ans2 = 0, 0
    for j in range(3):
        if A[i][j] == -1:
            ans1 += 1
        if A[j][i] == -1:
            ans2 += 1
    if ans1 or ans2 == 3:
        print("Yes")
        exit()

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

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):
        if A[i][j] in B:
            A[i][j] = -1

ans1, ans2 = 0, 0
for i in range(3):
    for j in range(3):
        if A[i][j] == -1:
            ans1 += 1
        if A[j][i] == -1:
            ans2 += 1
    if ans1 or ans2 == 3:
        print("Yes")
        exit()
    ans1, ans2 = 0, 0

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

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):
        if A[i][j] in B:
            A[i][j] = -1

ans1, ans2 = 0, 0
for i in range(3):
    for j in range(3):
        if A[i][j] == -1:
            ans1 += 1
        if A[j][i] == -1:
            ans2 += 1
    if ans1 or ans2 == 3:
        print("Yes")
        exit()
    ans1, ans2 = 0, 0

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

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):
        if A[i][j] in B:
            A[i][j] = -1

ans1, ans2 = 0, 0
for i in range(3):
    for j in range(3):
        if A[i][j] == -1:
            ans1 += 1
        if A[j][i] == -1:
            ans2 += 1
    if ans1 or ans2 == 3:
        print("Yes")
        exit()
    ans1, ans2 = 0, 0

if (A[0][0] == -1 and A[1][1] == -1 and A[2][2] == -1) or \
        (A[0][2] == -1 and A[1][1] == -1 and A[2][0] == -1):
    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)]

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

ans1, ans2 = 0, 0
for i in range(3):
    for j in range(3):
        if A[i][j] == 0:
            ans1 += 1
        if A[j][i] == 0:
            ans2 += 1
    if ans1 or ans2 == 3:
        print("Yes")
        exit()
    ans1, ans2 = 0, 0

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

Submission status: Wrong Answer

Solution code:
import numpy as np

arr = np.array([list(map(int, input().split())) for _ in range(3)])


n = int(input())

for _ in range(n):
    b = int(input())
    arr[np.where(arr == b)] = 0

ans1 = (np.sum(arr, axis=0) == 0).sum() == 3
ans2 = (np.sum(arr, axis=1) == 0).sum() == 3
ans3 = (np.diag(arr) == 0).sum() == 3
ans4 = (np.diag(np.rot90(arr)) == 0).sum() == 3

print("Yes" if ans1 or ans2 or ans3 or ans4 else "No")

Submission status: Wrong Answer

Solution code:
import numpy as np

A1=np.array(list(map(int,input().split())))
A2=np.array(list(map(int,input().split())))
A3=np.array(list(map(int,input().split())))
A=np.concatenate([A1,A2,A3]).reshape(3,3)

N=int(input())

for i in range(N):
    b=int(input())
    A[np.where(A==b)] = 0

if np.all(A[0,:]==0) or np.all(A[1,:]==0) or np.all(A[2,:]==0) or np.all(A[:,0]==0) or np.all(A[:,1]==0) \
    or np.all(A[:,2]==0) or A[0,0]**2+A[1,1]**2+A[2,2]**2==0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np

A1=np.array(list(map(int,input().split())))
A2=np.array(list(map(int,input().split())))
A3=np.array(list(map(int,input().split())))
A=np.concatenate([A1,A2,A3]).reshape(3,3)

N=int(input())

for i in range(N):
    b=int(input())
    A[np.where(A==b)] = 0
    if np.sum(A[0,:])==0 or np.sum(A[1,:])==0 or np.sum(A[2,:])==0 or np.sum(A[:,0])==0 or np.sum(A[:,1])==0\
         or np.sum(A[:,2])==0 or A[0,0]+A[1,1]+A[2,2]==0:
        print('Yes')
        break
else:
    print('No')

Submission status: Wrong Answer

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

N = int(input())

test = [[0]*3]*3

for i in range(N):
    b = int(input())
    for m in range(3):
        for n in range(3):
            if b == A[m][n]:
                test[m][n] =1

ans = 'No'
for i in range(3):
    if sum(test[i]) == 3:
        ans = 'Yes'
    if test[0][i]+test[1][i]+test[2][i] == 3:
        ans = 'Yes'

if test[0][0]+test[1][1]+test[2][2] == 3:
    ans = 'Yes'

if test[2][0]+test[1][1]+test[0][2] == 3:
    ans = 'Yes'

print(ans)

Submission status: Wrong Answer

Solution code:
A=list(map(lambda x: (int(x), False), input().split()))
A+=list(map(lambda x: (int(x), False), input().split()))
A+=list(map(lambda x: (int(x), False), input().split()))

N = int(input())
for _ in range(N):
  n = int(input())
  for a, b in A:
    if a == n:
      b = True
if (A[0][1] and ((A[1][1] and A[2][1]) or \
                       (A[3][1] and A[6][1]) or \
                       (A[4][1] and A[8][1]))) or \
          (A[1][1] and A[4][1] and A[7][1]) or \
          (A[2][1] and A[5][1] and A[8][1]) or \
          (A[3][1] and A[4][1] and A[5][1]) or \
          (A[6][1] and A[7][1] and A[8][1]) or \
          (A[2][1] and A[4][1] and A[6][1]):
    print("YES")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
board = [list(map(int,input().split())) for i in range(3)]
num = int(input())
for n in range(num):
    bi = int(input())
    for i in range(3):
        for j in range(3):
            if board[i][j] == bi:
                board[i][j] = 0

#横
for i in range(3):
    if board[i][0] == board[i][1] == board[i][2] == 0:
        print("Yes")
        exit()
#縦
for i in range(3):
    if board[0][j] == board[1][j] == board[2][j] == 0:
        print("Yes")
        exit()

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

print("No")

Submission status: Wrong Answer

Solution code:
board = [list(map(int,input().split())) for i in range(3)]
num = int(input())
for n in range(num):
    bi = int(input())
    for i in range(3):
        for j in range(3):
            if board[i][j] == bi:
                board[i][j] = 0

#横
for i in range(3):
    if board[i][0] == board[i][1] == board[i][2] == 0:
        print("Yes")
        exit()
#縦
for i in range(3):
    if board[0][j] == board[1][j] == board[2][j] == 0:
        print("Yes")
        exit()

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

print("No")

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 = [int(input(i)) for i in range(N)]

Bingo = [[A_1[0], A_1[1], A_1[2]],
         [A_2[0], A_2[1], A_2[2]],
         [A_3[0], A_3[1], A_3[2]],
         [A_1[0], A_2[0], A_3[0]],
         [A_1[1], A_2[1], A_3[1]],
         [A_1[2], A_2[2], A_3[2]],
         [A_1[0], A_2[1], A_3[2]],
         [A_1[2], A_2[1], A_3[0]],
         ]
num = [B]

if Bingo <= num:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def main():
    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

    ans = 'No'
    for i in range(3):
        if all(A[i]) == 0:
            ans = 'Yes'
    for i in range(3):
        if all([A[0][i], A[1][i], A[2][i]]) == 0:
            ans = 'Yes'
    if all([A[0][0], A[1][1], A[2][2]]) == 0:
        ans = 'Yes'
    if all([A[0][2], A[1][1], A[2][0]]) == 0:
        ans = 'Yes'

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    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

    for i in range(3):
        if all(A[i]) == 0:
            print('Yes')
            return
    for i in range(3):
        if all([A[0][i], A[1][i], A[2][i]]) == 0:
            print('Yes')
            return
    if all([A[0][0], A[1][1], A[2][2]]) == 0:
        print('Yes')
        return
    if all([A[0][2], A[1][1], A[2][0]]) == 0:
        print('Yes')
        return

    print('No')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

def check(arr):
    # 横チェック
    for i in range(len(arr)):
        if arr[i] == ["x", "x", "x"]:
            return True

    # 縦チェック
    for i in range(3):
        if arr[0][i] == "x" and arr[1][i] == "x" and arr[2][i]:
            return True

    # 斜めチェック
    if arr[0][0] == "x" and arr[1][1] == "x" and arr[2][2] == "x":
        return True
    elif arr[0][2] == "x" and arr[1][1] == "x" and arr[2][0] == "x":
        return True

    return False

n = int(input())
for _ in range(n):
    b = int(input())
    for i in range(len(arr)):
        tmp_arr = []
        for ele in arr[i]:
            if b == ele:
                tmp_arr.append("x")
            else:
                tmp_arr.append(ele)
        arr[i] = tmp_arr

if check(arr) == True:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().rstrip().split())
inl = lambda: list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))

a = inl()
b = inl()
c = inl()
n = ini()
bingo = []
for _ in range(n):
    bingo.append(ini())
ct = [0] * 9
for i in bingo:
    if i in a:
        ct[a.index(i)] = 1
    if i in b:
        ct[b.index(i) + 3] = 1
    if i in c:
        ct[c.index(i) + 6] = 1
print(ct)
if sum(ct[:3]) == 3 or sum(ct[3:6]) == 3 or sum(ct[6:9]) == 3:
    print("Yes")
elif ct[0] + ct[4] + ct[8] == 3 or ct[2] + ct[4] + ct[6] == 3:
    print("Yes")
elif ct[0] + ct[3] + ct[6] == 3 or ct[1] + ct[4] + ct[7] == 3 or ct[2] + ct[5] + ct[8] == 3:
    print("Yes")
else:
    print("No")