Problem:


Score : 200 points

Problem Statement

We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.

The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet.

Determine whether we will have a bingo when the N numbers are chosen, that is, the sheet will contain three marked numbers in a row, column, or diagonal.

Constraints

All values in input are integers.

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

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

1 \leq N \leq 10

1 \leq b_i \leq 100

b_i \neq b_j (i \neq j)

Input

Input is given from Standard Input in the following format:

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

Output

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

Sample Input 1

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

Sample Output 1

Yes

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

Sample Input 2

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

Sample Output 2

No

We will mark nothing.

Sample Input 3

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

Sample Output 3

Yes

We will mark all the squares.



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


Sample output:
Yes

Submission status: Wrong Answer

Solution code:
a = [[int(i) for i in input().split()] for _ in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]

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

Submission status: Wrong Answer

Solution code:
rows = []
for i in range(3):
    row = [int(x) for x in input().split()]
    rows.append(row)

N = int(input())
choice = []
for j in range(N):
    choice.append(int(input()))


for row in rows:
    match = [c for c in choice if c in row]

    if (len(match) >= 3):
        print("yes")
        break

columns = []
for k in range(3):
    column = [rows[l][k] for l in range(3)]
    columns.append(column)

for column in columns:
    match = [c for c in choice if c in column]

    if (len(match) >= 3):
        print("yes")
        break

left = []
for m in range(3):
    left.append(rows[m][m])

right = []
for n in range(3):
    for o in range(3)[::-1]:
        right.append(rows[n][o])

match_left = [c for c in choice if c in left]
match_right = [c for c in choice if c in right]

if (len(match_left) >= 3):
    print("yes")
elif (len(match_right) >= 3):
    print("yes")
else:
    print("no")

Submission status: Wrong Answer

Solution code:
A = []
for i in range(3):
    A+= list(map(int, input().split()))
N = int(input())
L = list()
for _ in range(N):
    L.append(int(input()))
_ = 0
for p in L:
    if p in A:
        print("Yes")
        break
    if _ == N-1:
        print("No")
    _+=1

Submission status: Wrong Answer

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

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

for b in B:
    for i in range(3):
        if b == A1[i]:
            A1[i] = 0
        if b == A2[i]:
            A2[i] = 0
        if b == A3[i]:
            A3[i] = 0


if ((A1[0] == 0 and A2[0] == 0 and A3[0] == 0) or
    (A1[1] == 0 and A2[1] == 0  and A3[1] == 0) or
    (A1[2] == 0 and A2[2] == 0  and A3[2] == 0) or
    (A1[0] == 0 and A1[1] == 0  and A1[2] == 0) or
    (A2[0] == 0 and A2[1] == 0  and A2[2] == 0) or
    (A3[1] == 0 and A3[1] == 0  and A3[2] == 0) or
    (A1[0] == 0 and A2[1] == 0  and A3[2] == 0) or
    (A1[2] == 0 and A2[1] == 0  and A3[0] == 0)):
    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 _ in range(n):
  b.append(int(input()))
c=[[0]*3 for _ in range(3)]
for i in b:
  res=0
  for j in a:
    cnt=0
    for k in j:
      if i==k:
        c[res][cnt]=1
      cnt+=1
    res+=1
ans="No"
if c[0][0] and c[1][1] and c[2][2]:
  ans="Yes"
if sum(c[0])==3:
  ans="Yes"
if sum(c[1])==3:
  ans="Yes"
if sum(c[2])==3:
  ans="Yes"
if c[0][2] and c[1][1] and c[2][0]:
  ans="Yes"
if c[0][1] and c[0][1] and c[0][2]:
  ans="Yes"
if c[1][1] and c[1][1] and c[1][2]:
  ans="Yes"
if c[2][1] and c[2][1] and c[2][2]:
  ans="Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
one = list(map(int, input().split()))
two = list(map(int, input().split()))
thr = list(map(int, input().split()))

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

ans = False

for i in range(2):
    try:
        if one[i] in b and two[i + 1] in b and thr[i + 2] in b:
            ans = True
    except:
        pass
    try:
        if one[i] in b and two[i - 1] in b and thr[i - 2] in b:
            ans = True
    except:
        pass
    try:
        if one[i] in b and two[i] in b and thr[i] in b:
            ans = True
    except:
        pass
    try:
        if one[0] in b and one[1] in b and one[2] in b:
            ans = True
    except:
        pass
    try:
        if two[0] in b and two[1] in b and two[2] in b:
            ans = True
    except:
        pass
    try:
        if thr[0] in b and thr[1] in b and thr[2] in b:
            ans = True
    except:
        pass
    try:
        if thr[0] in b and thr[1] in b and thr[2] in b:
            ans = True
    except:
        pass

if ans == False:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import numpy as np
a_1 = list(map(int,input().split()))
a_2 = list(map(int,input().split()))
a_3 = list(map(int,input().split()))
a = []
a.append(a_1)
a.append(a_2)
a.append(a_3)
bingo = [[False] * 3 for _ in range(3)]
n = int(input())
for _ in range(n):
    tmp = int(input())
    for x,row in enumerate(a):
        try:
            pos = [x,row.index(tmp)]
            bingo[pos[0]][pos[1]] = True
            break
        except ValueError:
            pass
bingo = np.array(bingo)
if (sum(bingo[0])) | (sum(bingo[1])) | (sum(bingo[2])) | (3 in np.sum(bingo,axis=0)):
    print('Yes')
elif ((bingo[0][0]==True) & (bingo[1][1]==True) & (bingo[2][2]==True)) | ((bingo[0][2]==True) & (bingo[1][1]==True) & (bingo[2][0]==True)):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
b1=list(map(int,input().split()))
b2=list(map(int,input().split()))
b3=list(map(int,input().split()))
n=int(input())

for i in range(n):
    bb=int(input())
    for j in range(3):
        if bb==b1[j]:
            b1[j]=0
        elif bb==b2[j]:
            b2[j]=0
        elif bb==b3[j]:
            b3[j]=0
if sum(b1)==0 or sum(b2)==0 or sum(b3)==0:
    print("Yes")
elif b1[0]==b2[1]==b3[2]==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd

mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
arr=[]
for i in range(3):
    mm=limii()
    arr.append(mm)

n=ii()

b=lin(n)

for i in range(3):
    for j in range(3):
        if arr[i][j] in b:
            arr[i][j]=0
chk=False

for i in range(3):
    if arr[0][i]==0 and arr[1][i]==0 and arr[2][i]==0:
        chk=True
    elif arr[i][0]==0 and arr[i][1]==0 and arr[i][2]==0:
        chk=True
if arr[0][0] ==0 and arr[1][1]==0 and arr[2][2]==0:
    chk=True

if chk==True:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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


def main():
    A = [list(map(int, input().split())) for _ in range(3)]
    print(A[0])
    a = [[False] * 3 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] = True
    for i in range(3):
        if all(a[i]):
            print("Yes")
            return
    for j in range(3):
        if all([a[0][j], a[1][j], a[2][j]]):
            print("Yes")
            return
    if a[0][0] and a[1][1] and a[2][2]:
        print("Yes")
        return
    if a[0][2] and a[1][1] and a[2][0]:
        print("Yes")
        return
    print("No")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
x=[[0 for i in range(3)] for j in range(3)]
N=int(input())
if N>=3:
  for i in range(N):
    b=int(input())
    for j in range(3):
      if A[j]==b:
        x[0][j]=1
      elif B[j]==b:
        x[1][j]=1
      elif C[j]==b:
        x[2][j]=1
  flag=0
  if x[0][0]==1:
    if x[0][1]==1 and x[0][2]==1:
      flag=1
    elif x[1][0]==1 and x[2][0]==1:
      flag=1
    elif x[1][1]==1 and x[2][2]==1:
      flag=1
  if x[1][1]==1:
    if x[0][1]==1 and x[2][1]==1:
      flag=1
    elif x[1][0]==1 and x[2][0]==1:
      flag=1
    elif x[0][2]==1 and x[2][0]==1:
      flag=1
  if x[2][2]==1:
    if x[2][0]==1 and x[2][1]==1:
      flag=1
    elif x[0][2]==1 and x[1][2]==1:
      flag=1
  if flag==1:
    print("Yes")
  else:
    print("No")
  #print(x)
else:
  print("No")

Submission status: Wrong Answer

Solution code:
a = [list(map(int, input().split())) for _ 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 a[j][k] == b:
          a[j][k] = 0
          if len(a[j]) == 0:
            print("Yes")
            exit()
        
if a[0][0] == 0 and a[1][0] == 0 and a[2][0] == 0:
  print("Yes")
elif a[0][1] == 0 and a[1][1] == 0 and a[2][1] == 0:
  print("Yes")
elif a[0][2] == 0 and a[1][2] == 0 and a[2][2] == 0:
  print("Yes")
elif a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0:
  print("Yes")
elif 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:
a1=list(map(int,input().split(" ")))
a2=list(map(int,input().split(" ")))
a3=list(map(int,input().split(" ")))
N=int(input())
b=[]

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

allnum=[]
allnum.append(a1)
allnum.append(a2)
allnum.append(a3)


bingo=[[0,0,0],[0,0,0],[0,0,0]]

for k in b:
    for i in range(3):
        for j in range(3):
            if(k==allnum[i][j]):
                bingo[i][j]=1

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

if(bingo[2][1] and bingo[1][1] and bingo[1][2]):
    print("yes")
    exit()
print("no")

Submission status: Wrong Answer

Solution code:
list1 = []
for x in range(3):
    list1.append([int(i)for i in input().split()])
n = int(input())
indices = []
for x in range(n):
    val = int(input())
    if val in list1[0]:
        indices.append([list1[0].index(val),0])
    elif val in list1[1]:
        indices.append([list1[1].index(val),1])
    elif val in list1[2]:
        indices.append([list1[2].index(val),2])
    else:
        indices.append(-1)
if [0,0] in indices and [0,1] in indices and [0,2] in indices:
    print("YES")
elif [1,0] in indices and [1,1] in indices and [1,2] in indices:
    print("YES")
elif [2,0] in indices and [2,1] in indices and [2,2] in indices:
    print("YES")
elif [0,0] in indices and [1,0] in indices and [2,0] in indices:
    print("YES")
elif [0,1] in indices and [1,1] in indices and [2,1] in indices:
    print("YES")
elif [0,2] in indices and [1,2] in indices and [2,2] in indices:
    print("YES")
elif [0,0] in indices and [1,1] in indices and [2,2] in indices:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
A = [list(map(int, input().split())) for _ 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 A[j][k] == b:
        A[j][k] = "x"
if A[0] == ["x","x","x"]:
  print("Yes")
elif A[1] == ["x","x","x"]:
  print("Yes")
elif A[2] == ["x","x","x"]:
  print("Yes")
elif A[0][0] == "x" and A[0][1] == "x" and A[0][2] == "x":
  peint("Yes")
elif A[1][0] == "x" and A[1][1] == "x" and A[1][2] == "x":
  print("Yes")
elif A[2][0] == "x" and A[2][1] == "x" and A[2][2] == "x":
  print("Yes")
elif A[0][0] == "x" and A[1][1] == "x" and A[2][2] == "x":
  print("Yes")
elif A[0][2] == "x" and A[1][1] == "x" and A[2][0] == "x":
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
l1=list(map(int ,input().split()))
l2=list(map(int ,input().split()))
l3=list(map(int ,input().split()))
l4=[l1[0],l2[1],l3[2]]
l5=[l1[2],l2[1],l3[0]]
n = int(input())
l=[int(input()) for x in range(n)]

if l1[0] and l1[1] and l1[2] in l:
    print("Yes")
elif l2[0] and l2[1] and l2[2] in l:
    print("Yes")
elif l3[0] and l3[1] and l3[2] in l:
    print("Yes")
elif l4[0] and l4[1] and l4[2] in l:
    print("Yes")
elif l5[0] and l5[1] and l5[2] in l:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
L = []
bingo = set()
Numbers = []
testor = 0
for i in range(3):
  a,b,c = map(int,input().split())
  L.append((a,b,c)) #00 10 20/ 01 11 21/ 02 12 22/00 11 22/ 20 11 02/
N = int(input())
for i in range(3):
  a = L[0][i] 
  b = L[1][i]
  c = L[2][i]
  L.append((a,b,c))
a = L[0][0]
b = L[1][1]
c = L[2][2]
L.append((a,b,c))
a = L[2][0] 
b = L[1][1]
c = L[0][2]
L.append((a,b,c))
for i in range(N):
  Numbers.append(int(input()))
for i in range(7): #8 bingos pattern
  bingo = L[i]
  for k in range(N):
    if Numbers[k] in bingo:
      testor += 1
  if testor == 3:
    print('Yes')
    sys.exit(0)
  testor = 0
print('No')

Submission status: Wrong Answer

Solution code:
#!python3.4.3

a = []
result = []

for i in range(3):
  a.append(list(map(int, input().split(' '))))
  
a_flat = sum(a, [])
n = int(input())

for _ in range(n):
  b = int(input())
  
  if b in a_flat:
    result.append(a_flat.index(b))


if result and (result in [0, 1, 2] or [3, 4, 5] or [6, 7, 8] or [0, 3, 4] or [1, 4, 7] or [2, 5, 8] or [0, 4, 8] or [2, 4, 6]):
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
A=[]
A.append(list(map(int,input().split())))
A.append(list(map(int,input().split())))
A.append(list(map(int,input().split())))
n=int(input())
L=[]
for i in range(n):
    L.append(int(input()))
M=[[0,0,0],[0,0,0],[0,0,0]]
for i in L:
    for j in range(3):
        for k in range(3):
            if i==A[j][k]:
                M[j][k]=1
for i in range(3):
    if sum(M[i])==3:
        print("Yes")
        exit()
if M[i][0]+M[i][1]+M[i][2]==3 or M[0][0]+M[1][1]+M[2][2]==3 or M[0][2]+M[1][1]+M[2][0]==3:
    print("Yes")
    exit()
print("No")

Submission status: Wrong Answer

Solution code:
a_list = [[int(i) for i in input().split()] for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]

flag = False

for i in range(3):
    if all([True if j in b else False for j in a_list[i]]):
        print('Yes')
        flag = True
        break

if flag == False:
    for i in range(3):
        if all([True if a_list[i][j] in b else False for j in range(3)]):
            print('Yes')
            flag = True
            break

if flag == False:
    temp1 = [(0,0), (1,1), (2,2)]
    if all([True if a_list[i][j] in b else False for (i,j) in temp1]):
        print('Yes')
        flag = True

if flag == False:
    temp2 = [(0,2), (1,1), (2,0)]
    if all([True if a_list[i][j] in b else False for (i,j) in temp2]):
        print('Yes')
        flag = True
    
if flag == False:
    print('No')

Submission status: Wrong Answer

Solution code:
from collections import defaultdict as dd
a = []
for _ in range(3):
  temp = list(map(int,input().split()))
  a.append(temp)
  
m1 = dd(int)
n = int(input())

for _ in range(n):
  temp = int(input())
  m1[temp]+=1
  
cnt=0
flag=0
for i in range(3):
  cnt=0
  for j in range(3):
    if m1[a[i][j]]==1:
      cnt+=1
  if cnt==3:
    print("Yes")
    flag=1
    break

if flag==0:
  for i in range(3):
    cnt=0
    for j in range(3):
      if m1[a[j][i]]==1:
        cnt+=1
        
    if cnt==3:
      print("Yes")
      flag=1
      break
      
if flag==0:
  cnt=0
  for i in range(3):
    if m1[a[i][i]]==1:
      cnt+=1
  if cnt==3:
    print("Yes")
    flag=1
    
if flag==0:
  cnt=0;j=2
  for i in range(3):
    if m1[a[i][j]]==1:
      cnt+=1
  if cnt==3:
    print("Yes")
    flag=1
    
if flag==0:
  print("No")

Submission status: Wrong Answer

Solution code:


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

A_List_1 = list(map(int,input().split()))
A_List_2 = list(map(int,input().split()))
A_List_3 = list(map(int,input().split()))

#print(A_List_1)
#print(A_List_2)
#print(A_List_3)

N = int(input())
#B_List = []
for i in range(N):
    n = int(input())
    for j in range(3):
        if n == A_List_1[j]:
            A_List_1[j] = 0
        if n == A_List_2[j]:
            A_List_2[j] = 0
        if n == A_List_3[j]:
            A_List_3[j] = 0


sum_1 = A_List_1[0] + A_List_1[1] + A_List_1[2]
sum_2 = A_List_2[0] + A_List_2[1] + A_List_2[2]
sum_3 = A_List_3[0] + A_List_3[1] + A_List_3[2]
naname_1 = A_List_1[0] + A_List_2[1] + A_List_3[2]
naname_2 = A_List_1[2] + A_List_2[1] + A_List_1[0]
tate_0 = A_List_1[0] + A_List_2[0] + A_List_3[0]
tate_1 = A_List_1[1] + A_List_2[1] + A_List_3[1]
tate_2 = A_List_1[2] + A_List_2[2] + A_List_3[2]

if sum_1 == 0 or sum_2 == 0 or sum_3 == 0 or naname_1 == 0 or naname_2 == 0 or tate_0 == 0 or tate_1 == 0 or tate_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)]
han=[]
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
if A[0][0]==A[0][1]==A[0][2]==0 or A[1][0]==A[1][1]==A[1][2]==0 or A[2][0]==A[2][1]==A[2][2]==0:
    print("Yes")
    exit()
if A[0][0]==A[1][0]==A[2][0]==0 or A[0][1]==A[1][1]==A[2][1]==0 or A[0][2]==A[1][2]==A[2][2]==0:
    print("Yes")
    exit()
if A[0][0]==A[1][1]==A[2][2]==0 or A[0][2]==A[2][2]==A[0][3]:
    print("Yes") 
    exit()
print("No")

Submission status: Wrong Answer

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

tmp = []

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:
                tmp.append((j,k))

ans = [[(0,0),(1,1),(2,2)],[(0,2),(1,1),(2,0)],[(0,0),(0,1),(0,2)],[(1,0),(1,1),(1,2)],[(2,0),(2,1),(2,2)],[(0,0),(0,1),(0,2)],[(1,0),(1,1),(1,2)],[(2,0),(2,1),(2,2)]]

for i in ans:
    count = 0
    for j in tmp:
        if j in i:
            count += 1
        if count == 3:
            print('Yes')
            exit()
print('No')

Submission status: Wrong Answer

Solution code:
import itertools

bingo = []

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

bingo = list(itertools.chain.from_iterable(bingo))

bingo_bi = [False for _ in range(9)]

n = int(input())

nums = []

for _ in range(n):
    num = int(input())
    if num in bingo:
        bingo_bi[bingo.index(num)] = True

correct = [True, True, True]

if bingo_bi[0:2] == correct and bingo_bi[3:5] == correct and bingo_bi[6:8] == correct:
    print('Yes')
elif bingo_bi[0::3] == correct and bingo_bi[1::3] == correct and bingo_bi[2::3] == correct:
    print('Yes')
elif bingo_bi[0] == True and bingo_bi[4] == True and bingo_bi[8] == True:
    print('Yes')
elif bingo_bi[2:8:2] == correct:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

import sys

DEBUG = False

def solve():
    return


def read_int_list(sep = " "):
    return [int(s) for s in sys.stdin.readline().rstrip().split(sep)]

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

def dprint(*args, **kwargs):
    if DEBUG:
        print(*args, **kwargs)
    return


def main():
    bingo = [[]] * 3
    bingo[0] = read_int_list()
    bingo[1] = read_int_list()
    bingo[2] = read_int_list()
    locs = {}
    for y in range(0, 3):
        for x in range(0, 3):
            locs[bingo[y][x]] = (y, x)
            
    n = read_int()
    for _ in range(0, n):
        b = read_int()
        if b in locs:
            bingo[locs[b][0]][locs[b][1]] = -1
    
    # column check
    for y in range(0, 3):
        is_bingo = True
        for x in range(0, 3):
            if bingo[y][x] != -1:
                is_bingo = False
                break
        if is_bingo:
            print("Yes")
            return
    # row check
    for x in range(0, 3):
        is_bingo = True
        for y in range(0, 3):
            if bingo[y][x] != -1:
                is_bingo = False
                break
        if is_bingo:
            print("Yes")
            return
    # cross check
    for (x, y), (dx, dy) in [((0, 0), (1, 1)), ((2, 2), (-1, -1))]:
        is_bingo = True
        while is_bingo and 0 <= y < 3 and 0 <= x < 3:
            if bingo[y][x] != -1:
                is_bingo = False
                break
            y += dy
            x += dx
        if is_bingo:
            print("Yes")
            return
    print("No")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n1,n2,n3=map(int, input().split())
n4,n5,n6=map(int, input().split())
n7,n8,n9=map(int, input().split())
M=[n1,n2,n3,n4,n5,n6,n7,n8,n9]
O=[0,0,0,0,0,0,0,0,0]
N=int(input())
for i in range(N):
 a=int(input())
 if a in M:
  b=M.index(a)
  if O[b]==0:
   O[b]+=1
a1=[1,0,0,1,0,0,1,0,0]
a2=[0,1,0,0,1,0,1,1,0]
a3=[0,0,1,0,0,1,0,0,1]
a4=[1,1,1,0,0,0,0,0,0]
a5=[0,0,0,1,1,1,0,0,0]
a6=[0,0,0,0,0,0,1,1,1]
a7=[1,0,0,0,1,0,0,0,1]
a8=[0,0,1,0,1,0,1,0,0]
a=[a1,a2,a3,a4,a5,a6,a7,a8]
d=0
for i in range(8):
 c=0
 for j in range(9):
  c+=a[i][j]*O[j]
 if c==3:
  d+=1
if d>=1:
 print("Yes")
else:
 print("No")

Submission status: Wrong Answer

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

aListCheck = []
for i in range(3):
  aListCheckRow = []
  for j in range(3):
    aListCheckRow.append(aList[i][j] in bList)
  aListCheck.append(aListCheckRow)

for i in range(3):
  if aListCheck[i][0] and aListCheck[i][1] and aListCheck[i][2]:
    print('YES')
    exit()
  if aListCheck[0][i] and aListCheck[1][i] and aListCheck[2][i]:
    print('YES')
    exit()
if aListCheck[0][0] and aListCheck[1][1] and aListCheck[2][2]:
  print('YES')
  exit()
if aListCheck[0][2] and aListCheck[1][1] and aListCheck[2][0]:
  print('YES')
  exit()

print('No')

Submission status: Wrong Answer

Solution code:
a = []
a.append(list(map(int, input().split())))
a.append(list(map(int, input().split())))
a.append(list(map(int, input().split())))

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

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

Submission status: Wrong Answer

Solution code:
a=[]
b=[]
nums=[]
ans="No"

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

n=int(input())

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

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
                num=10*(j+1)+k+1
                nums.append(num)

nums.sort()

for i in nums:
    if i==i+1==i+2==0:
        ans="Yes"
    if i==i+10==i+20==0:
        ans="Yes"
        
if 11 in nums and 22 in nums and 33 in nums:
    ans="Yes"

if 13 in nums and 22 in nums and 31 in nums:
    ans="Yes"
    
print(ans)

Submission status: Wrong Answer

Solution code:
#python3

def main():
    a = []
    for _ in range(3):
        x, y, z = map(int, input().split())
        a.append((x, y, z))
    n = int(input())
    b =[]
    for _ in range(n):
        b.append(int(input()))

    g = [[0 for _ in range(3)] for _ in range(3)]
    for i in range(3):
        for j in range(3):
            flag = False
            for k in range(n):
                if a[i][j] == b[k]:
                    flag = True
            if flag:
                g[i][j] = 1
    bingo = False
    for i in range(3):
        flag = True
        if g[i][i] != 1:
            flag = False
        if flag:
            bingo = True            
    
    for i in range(3):
        if sum(g[i]) == 3:
            bingo = True

    for k in range(3): 
        for i in range(3):
            s = 0
            s += g[i][k]
            if s == 3:
                bingo = True 
    
    if bingo:
        print('Yes')
    else:
        print('No')
main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
grid = []
for _ in range(3):
    array = list(map(int, input().strip().split()))
    grid.append(array)

def judge():
    for i in range(3):
        if grid[i][0] == 0 and grid[i][1] == 0 and grid[i][2] == 0:
            return True
    if grid[0][0] == 0 and grid[1][1] == 0 and grid[2][2] == 0:
        return True
    if grid[0][2] == 0 and grid[1][1] == 0 and grid[2][0] == 0:
        return True
    return False

n = int(input())
ans = "No"
for _ in range(n):
    b = int(input())
    for i in range(3):
        if b in grid[i]:
            grid[i][grid[i].index(b)] = 0
    if judge():
        ans = "Yes"
#    print (grid)

print (ans)

Submission status: Wrong Answer

Solution code:
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
N = int(input())
b = [int(input()) for _ in range(N)]

cnt1 = 0
for i in A1:
    if i in b:
        cnt1 += 1
    if cnt1 == 3:
        flag1 = 1
    else:
        flag1 = 0

cnt2 = 0
for i in A2:
    if i in b:
        cnt2 += 1
    if cnt2 == 3:
        flag2 = 1
    else:
        flag2 = 0

cnt3 = 0
for i in A3:
    if i in b:
        cnt3 += 1
    if cnt3 == 3:
        flag3 = 1
    else:
        flag3 = 0

cnt4 = 0
for i in [A1[0], A2[1], A3[2]]:
    if i in b:
        cnt4 += 1
    if cnt4 == 3:
        flag4 = 1
    else:
        flag4 = 0

if flag1 == 1 or flag2 == 1 or flag1 == 3 or flag4 == 1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
A=[]
for i in [0]*3:
    A+=list(map(int,input().split()))
N=int(input())
B=[0]*9
for i in range(N):
    i=int(input())
    if i in A:
        B[A.index(i)]=1
res=0
for i in range(3):
    res+=B[i]*B[i+1]*B[i+2]
    res+=B[i]*B[i+3]*B[i+6]
res+=B[0]*B[4]*B[8]+B[2]*B[4]*B[6]
print(['No','Yes'][res>0])

Submission status: Wrong Answer

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

N = int(input())

for i in range(N):
    b = int(input())
    for j in range(3):
        if b in A[j]:
            idx = A[j].index(b)
            bingo[j][idx] = True

# check
migiue = True
migisita = True
for i in range(3):
    tate = True
    yoko = True
    for j in range(3):
        if bingo[i][j] == False:
            yoko = False
        if bingo[j][i] == False:
            tate = False
    if tate or yoko:
        print('Yes')
        break
    if bingo[i][i] == False:
        migisita = False
    if bingo[-i-1][-i-1] == False:
        migiue = False
else:
    if migiue or migisita:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np

bingo = np.zeros((3,3))
bin_bingo = np.zeros((3,3))


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

N = int(input())

for _ in range(N):
    num = int(input())
    bin_bingo = np.logical_or(bin_bingo, bingo == num)

# find bingo
lin1 = np.array([[True, True, True], [False, False, False], [False, False, False]])
lin2 = np.array([[False, False, False],[True, True, True], [False, False, False]])
lin3 = np.array([[False, False, False], [False, False, False], [True, True, True]])
col1 = lin1.T
col2 = lin2.T
col3 = lin3.T

sla1 = np.array([[True, False, False], [False, True, False], [False, False, True]])
sla2 = np.array([[False, False, True], [False, True, False], [True, False, False]])

def is_bingo(src, tmp):
    return (np.logical_and(bin_bingo, sla1) == sla1).all()

flg = False
if is_bingo(bin_bingo, lin1):
    flg = True
elif is_bingo(bin_bingo, lin2):
    flg = True
    
elif is_bingo(bin_bingo, lin3):
    flg = True

elif is_bingo(bin_bingo, col1):
    flg = True
elif is_bingo(bin_bingo, col2):
    flg = True
elif is_bingo(bin_bingo, col3):
    flg = True
elif is_bingo(bin_bingo, sla1):
    flg = True
elif is_bingo(bin_bingo, sla2):
    flg = True

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