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:
al = [map(int, input().split()) for i in range(3)]
n = int(input())
bl = [int(input()) for i in range(n)]
check = [0 for i in range(9)]

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

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

Submission status: Wrong Answer

Solution code:
import math

def main():
  A1 = list()
  A2 = list()
  A3 = list()
  
  A1 = list(map(int, input().split()))
  A2 = list(map(int, input().split()))
  A3 = list(map(int, input().split()))
  A = A1 + A2 + A3
  
  N = int(input())
  B = [int(input()) for _ in range(N)]
    
  for a in range(0, len(A)):
    for b in range(0, N):
      if A[a] == B[b]:
        A[a] += 100
        
  if A[0] + A[1] + A[2] > 300:
    print('Yes')
  elif A[3] + A[4] + A[5] > 300:
    print('Yes')
  elif A[6] + A[7] + A[8] > 300:
    print('Yes')
  elif A[0] + A[3] + A[6] > 300:
    print('Yes')
  elif A[1] + A[4] + A[7] > 300:
    print('Yes')
  elif A[2] + A[5] + A[8] > 300:
    print('Yes')
  elif A[0] + A[4] + A[8] > 300:
    print('Yes')
  elif A[2] + A[4] + A[6] > 300:
    print('Yes')
  else:
    print('No')
main()

Submission status: Wrong Answer

Solution code:
#B
a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
for i in range(n):
    m = int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k] == m:
                a[j][k] = 0
f = False
print(a)
for j in range(3):
    if a[j][0] == 0 and a[j][1] == 0 and a[j][2] == 0:
        f = True
    if a[0][j] == 0 and a[1][j] == 0 and a[2][j] == 0:
        f = True
if (a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0) or (a[2][0] == 0 and a[1][1] == 0 and a[0][2] == 0):
    f = True
if f:
    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)]

ans = [[0] * 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] :
          ans[i][j] = 1

chk = False
if ans[0][0] == ans[0][1] == ans[0][2] :
  print("Yes")
elif ans[1][0] == ans[1][1] == ans[1][2] :
  print("Yes")
elif ans[2][0] == ans[2][1] == ans[2][2] :
  print("Yes")
elif ans[0][0] == ans[1][0] == ans[2][0] :
  print("Yes")
elif ans[0][1] == ans[1][1] == ans[2][1] :
  print("Yes")
elif ans[0][2] == ans[1][2] == ans[2][2] :
  print("Yes")
elif ans[0][0] == ans[1][1] == ans[2][2] :
  print("Yes")
elif ans[0][2] == ans[1][1] == ans[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())

for j in range(n):
    b = int(input())
    for j in range(3):
        if A[j][0] == b:
            A[j][0] = 0
        if A[j][1] == b:
            A[j][1] = 0
        if A[j][2] == b:
            A[j][2] = 0

for k in range(3):
    if A[k][0]==A[k][1]==A[k][2]==0:
        print("Yes")
        exit
    elif A[0][k]==A[1][k]==A[2][k]==0:
        print("Yes")
        exit
if A[0][0]==A[1][1]==A[2][2]==0:
    print("Yes")
    exit
elif A[0][2]==A[1][1]==A[2][0]==0:
    print("Yes")
    exit
else:
    print("No")

Submission status: Wrong Answer

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

n = int(input())

for j in range(n):
    b = int(input())
    for j in range(3):
        if A[j][0] == b:
            A[j][0] = 0
        if A[j][1] == b:
            A[j][1] = 0
        if A[j][2] == b:
            A[j][2] = 0

for k in range(3):
    if A[k][0]==A[k][1]==A[k][2]==0:
        print("Yes")
        exit
    elif A[0][k]==A[1][k]==A[2][k]==0:
        print("Yes")
        exit
if A[0][0]==A[1][1]==A[2][2]==0:
    print("Yes")
elif A[0][2]==A[1][1]==A[2][0]==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())

for j in range(n):
    b = int(input())
    for j in range(3):
        if A[j][0] == b:
            A[j][0] = 0
        if A[j][1] == b:
            A[j][1] = 0
        if A[j][2] == b:
            A[j][2] = 0

for k in range(3):
    if A[k][0]==A[k][1]==A[k][2]==0:
        print("Yes")
    elif A[0][k]==A[1][k]==A[2][k]==0:
        print("Yes")
        exit
if A[0][0]==A[1][1]==A[2][2]==0:
    print("Yes")
elif A[0][2]==A[1][1]==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())

for i in range(n):
    b = int(input())
    for j in range(3):
        if A1[j] == b:
            A1[j] = 0
        if A2[j] == b:
            A2[j] = 0
        if A3[j] == b:
            A3[j] = 0

if A1[0]==A1[1]==A1[2]==0:
    print("Yes")
    exit
if A2[0]==A2[1]==A2[2]==0:
    print("Yes")
    exit
if A3[0]==A3[1]==A3[2]==0:
    print("Yes")
    exit

if A1[0]==A2[0]==A3[0]==0:
    print("Yes")
    exit
if A1[1]==A2[1]==A3[1]==0:
    print("Yes")
    exit
if A1[2]==A2[2]==A3[2]==0:
    print("Yes")
    exit
    
if A1[0]==A2[1]==A3[2]==0:
    print("Yes")
    exit
if A1[2]==A2[1]==A3[0]==0:
    print("Yes")
    exit
else:
    print("No")

Submission status: Wrong Answer

Solution code:
A11, A12, A13 = input().split(' ')
A21, A22, A23 = input().split(' ')
A31, A32, A33 = input().split(' ')
N = int(input())
b = []
for i in range(N):
  bi = input()
  b.append(bi)
if A11 and A12 and A13 in b:
  print('Yes')
elif A21 and A22 and A23 in b:
  print('Yes')
elif A31 and A32 and A33 in b:
  print('Yes')
elif A11 and A21 and A31 in b:
  print('Yes')
elif A12 and A22 and A32 in b:
  print('Yes')
elif A13 and A23 and A33 in b:
  print('Yes')
elif A11 and A22 and A33 in b:
  print('Yes')
elif A13 and A22 and A31 in b:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
A11, A12, A13 = input().split(' ')
A21, A22, A23 = input().split(' ')
A31, A32, A33 = input().split(' ')
N = int(input())
b = []
for i in range(N):
  b = input()
if A11 and A12 and A13 in b:
  print('Yes')
elif A21 and A22 and A23 in b:
  print('Yes')
elif A31 and A32 and A33 in b:
  print('Yes')
elif A11 and A21 and A31 in b:
  print('Yes')
elif A12 and A22 and A32 in b:
  print('Yes')
elif A13 and A23 and A33 in b:
  print('Yes')
elif A11 and A22 and A33 in b:
  print('Yes')
elif A13 and A22 and A31 in 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()))
N = int(input())

for i in range(N):
    b = int(input())
    for t in range(3):
        if A1[t] == b:
            A1[t] = -1
        elif A2[t] == b:
            A2[t] = -1
        elif A3[t] == b:
            A3[t] = -1

if A1 == A2 == A3 == [-1, -1, -1] \
        or A1[1] == A2[1] == A3[1] == -1 \
        or A1[2] == A2[2] == A3[2] == -1 \
        or A1[0] == A2[0] == A3[0] == -1 \
        or A1[0] == A2[1] == A3[2] == -1 \
        or A1[2] == A2[1] == A3[0] == -1 \
        or A1[0] == A2[0] == A3[0] == -1 \
        or A1[1] == A2[1] == A3[1] == -1 \
        or A1[2] == A2[2] == A3[2] == -1:
    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())

for i in range(N):
    b = int(input())
    for t in range(3):
        if A1[t] == b:
            A1[t] = -1
        elif A2[t] == b:
            A2[t] = -1
        elif A3[t] == b:
            A3[t] = -1

if A1 == A2 == A3 == [-1, -1, -1] \
        or A1[1] == A2[1] == A3[1] == -1 \
        or A1[2] == A2[2] == A3[2] == -1 \
        or A1[0] == A2[0] == A3[0] == -1 \
        or A1[0] == A2[1] == A3[2] == -1 \
        or A1[2] == A2[1] == A3[0] == -1 \
        or A1[0] == A2[0] == A3[0] == -1 \
        or A1[1] == A2[1] == A3[1] == -1 \
        or A1[2] == A2[2] == A3[2] == -1:
    print('Yes')
else:
    print('No')
print(A1)
print(A2)
print(A3)

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

for i in range(N):
    b = int(input())
    for t in range(3):
        if A1[t] == b:
            A1[t] = -1
        elif A2[t] == b:
            A2[t] = -1
        elif A3[t] == b:
            A3[t] = -1

if A1 == A2 == A3 == [-1, -1, -1] \
        or A1[1] == A2[1] == A3[1] == -1 \
        or A1[2] == A2[2] == A3[2] == -1 \
        or A1[0] == A2[0] == A3[0] == -1 \
        or A1[0] == A2[1] == A3[2] == -1 \
        or A1[2] == A2[1] == A3[0] == -1 \
        or A1[0] == A2[0] == A3[0] == -1 \
        or A1[1] == A2[1] == A3[1] == -1 \
        or A1[2] == A2[2] == A3[2] == -1:
    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())

for i in range(N):
    b = int(input())
    for t in range(3):
        if A1[t] == b:
            A1[t] = -1
        elif A2[t] == b:
            A2[t] = -1
        elif A3[t] == b:
            A3[t] = -1

if A1 == A2 == A3 == [-1, -1, -1] \
        or A1[1] == A2[1] == A3[1] == -1 \
        or A1[2] == A2[2] == A3[2] == -1 \
        or A1[0] == A2[0] == A3[0] == -1 \
        or A1[0] == A2[1] == A3[2] == -1 \
        or A1[2] == A2[1] == A3[0] == -1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ka = a + b + c
x = int()
n = int(input())
for i in range(n):
    k = int(input())
    if k in ka: ka[ka.index(k)] = x
print(ka)
ans = "No"
if ka[0] == x and ka[1] == x and ka[2] == x:ans = "Yes"
elif ka[3] == x and ka[4] == x and ka[5] == x:ans = "Yes"
elif ka[6] == x and ka[7] == x and ka[8] == x:ans = "Yes"
elif ka[0] == x and ka[3] == x and ka[6] == x:ans = "Yes"
elif ka[1] == x and ka[4] == x and ka[7] == x:ans = "Yes"
elif ka[2] == x and ka[5] == x and ka[8] == x:ans = "Yes"
elif ka[0] == x and ka[4] == x and ka[8] == x:ans = "Yes"
elif ka[2] == x and ka[4] == x and ka[6] == x:ans = "Yes"
print(ans)

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 = a+b+c
ball = []
ans = "No"
N = int(input())
for i in range(N) :
    b = int(input())
    ball.append(b)

for i in range(3) :
    if (x[i] and x[i+3] and x[i+6]) in ball :
        ans = "Yes"
    if (x[3*i] and x[3*i+1] and x[3*i+2]) in ball :
        ans = "Yes"
if (x[0] and x[4] and x[8]) in ball :
    ans = "Yes"
if (x[2] and x[4] and x[6]) in ball :
    ans = "Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

A11 ,A12 ,A13 = (int(a) for a in input().split())
A21 ,A22 ,A23 = (int(a) for a in input().split())
A31 ,A32 ,A33 = (int(a) for a in input().split())
ball = []
N = int(input())
for i in range(N) :
    b = int(input())
    ball.append(b)
if (A11 and A12 and A13) in ball :
    print("Yes")
    sys.exit()
if (A21 and A22 and A23) in ball :
    print("Yes")
    sys.exit()
if (A31 and A32 and A33) in ball :
    print("Yes")
    sys.exit()
if (A11 and A21 and A31) in ball :
    print("Yes")
    sys.exit()
if (A12 and A22 and A32) in ball :
    print("Yes")
    sys.exit()
if (A13 and A23 and A33) in ball :
    print("Yes")
    sys.exit()
if (A11 and A22 and A33) in ball :
    print("Yes")
    sys.exit()
if (A13 and A22 and A31) in ball :
    print("Yes")
    sys.exit()
print("No")

Submission status: Wrong Answer

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

C=[[False]*3 for _ in range(3)]
D=[(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2)]

N=int(input())
for _ in range(N):
    b=int(input())
    for (p,q) in D:
        if A[p][q]==b:
            C[p][q]=1

T=False
for i in range(3):
    U=True
    for j in range(3):
        U&=C[i][j]
    T|=U
    
for j in range(3):
    U=True
    for i in range(3):
        U&=C[i][j]
    T|=U 

U=True
for i in range(3):
    U&=C[i][i]
T|=U

U=True
for i in range(3):
    U&=C[i][2-j]
T|=U

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

Submission status: Wrong Answer

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

C=[[False]*3 for _ in range(3)]
D=[(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2)]

N=int(input())
for _ in range(N):
    b=int(input())
    for (p,q) in D:
        if A[p][q]==b:
            C[p][q]=1

T=False
for i in range(3):
    U=True
    for j in range(3):
        U&=C[i][j]
    T|=U
    
for j in range(3):
    U=True
    for i in range(3):
        U&=C[i][j]
    T|=U 

U=True
for i in range(3):
    U&=C[i][i]
T|=U

for i in range(3):
    U&=C[i][2-j]
T|=U

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

Submission status: Wrong Answer

Solution code:
row1 = list(map(int,input().split()))
row2 = list(map(int,input().split()))
row3 = list(map(int,input().split()))

n = int(input())
nums = []
ans = "No"

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

for i in range(0,3):
  if row1[i] in nums: row1[i] == "O"
  if row2[i] in nums: row2[i] == "O"
  if row3[i] in nums: row3[i] == "O"

#Columns
for i in range(0,3):
  if row1[i] == row2[i] == row3[i]: ans = "Yes"
    
#Rows
if row1 == ["O","O","O"] or row2 == ["O","O","O"] or row3 == ["O","O","O"]: ans = "Yes"
  
#Diagonals
if row1[0] == row2[1] == row3[2] or row1[2] == row2[1] == row3[0]: ans = "Yes"
  
print(ans)

Submission status: Wrong Answer

Solution code:
row1 = list(map(int,input().split()))
row2 = list(map(int,input().split()))
row3 = list(map(int,input().split()))

n = int(input())
nums = []
ans = "No"

for i in range(0, n):
  nums.append(int(input()))
  
for i in range(0,3):
  if row1[i] in nums: row1[i] == "O"
  if row2[i] in nums: row2[i] == "O"
  if row3[i] in nums: row3[i] == "O"
    
#Columns
for i in range(0,3):
  if row1[i] == row2[i] == row3[i]: ans = "Yes"
    
#Rows
if row1 == ["O","O","O"] or row2 == ["O","O","O"] or row3 == ["O","O","O"]: ans = "Yes"
  
#Diagonals
if row1[0] == row2[1] == row3[2] or row1[2] == row2[1] == row3[0]: ans = "Yes"
  
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos,sin,tan,sqrt
import cmath as cma
import copy as cp
import sys
import re
import bisect as bs
sys.setrecursionlimit(10**7)
EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf
MOD = 10**9 + 7

def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def adj(n): return [[] for _ in range(n)]

a = np.array([iarr() for i in range(3)])
n = iinput()
for i in range(n):
    b = iinput()
    for i in range(3):
        for j in range(3):
            if a[i][j] == b: a[i][j] = 0

#vertical = np.all(a == 0, axis=0)
vertical = np.array([all(elm==0 for elm in a[i]) for i in range(3)])
horizontal = np.all(a == 0, axis=1)
diagonal = a[0][0]==a[1][1]==a[2][2]==0 or a[0][2]==a[1][1]==a[2][0]
flag = np.any(vertical==1) or np.any(horizontal==1) or diagonal
ans = "Yes" if flag else "No"
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos,sin,tan,sqrt
import cmath as cma
import copy as cp
import sys
import re
import bisect as bs
sys.setrecursionlimit(10**7)
EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf
MOD = 10**9 + 7

def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def adj(n): return [[] for _ in range(n)]

a = np.array([iarr() for i in range(3)])
n = iinput()
for i in range(n):
    b = iinput()
    for i in range(3):
        for j in range(3):
            if a[i][j] == b: a[i][j] = 0

#vertical = np.all(a == 0, axis=0)
vertical = [all(elm==0 for elm in a[i]) for i in range(3)]
horizontal = np.all(a == 0, axis=1)
diagonal = a[0][0]==a[1][1]==a[2][2]==0 or a[0][2]==a[1][1]==a[2][0]
flag = np.any(vertical==1) or np.any(horizontal==1) or diagonal
ans = "Yes" if flag else "No"
print(ans)

Submission status: Wrong Answer

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

cl = [[0,0,0],[0,0,0],[0,0,0]]

n = int(input())
st = set()
for _ in range(n):
    st.add(int(input()))

for _ in range(len(st)):
    for i in range(3):
        for j in range(3):
            if bingo[i][j] in st:
                cl[i][j] = 1

if sum(cl[0]) == 3 or sum(cl[1]) == 3 or sum(cl[2]) == 3:
    print('Yes')
    sys.exit()
elif sum(cl[:][0]) == 3 or sum(cl[:][1]) == 3 or sum(cl[:][2]) == 3:
    print('Yes')
    sys.exit()
elif cl[0][0]+cl[1][1]+cl[2][2] == 3 or cl[0][2]+cl[1][1]+cl[2][0] == 3:
    print('Yes')
    sys.exit()
else:
    print('No')
    sys.exit()

Submission status: Wrong Answer

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

cl = [[0,0,0],[0,0,0],[0,0,0]]

n = int(input())
st = set()
for _ in range(n):
    st.add(int(input()))

for _ in range(len(st)):
    for i in range(3):
        for j in range(3):
            if bingo[i][j] in st:
                cl[i][j] = 1

if sum(cl[0]) == 3 or sum(cl[1]) == 3 or sum(cl[2]) == 3:
    print('Yes')
elif sum(cl[:][0]) == 3 or sum(cl[:][1]) == 3 or sum(cl[:][2]) == 3:
    print('Yes')
elif cl[0][0]+cl[1][1]+cl[2][2] == 3 or cl[0][2]+cl[1][1]+cl[2][0] == 3:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

cl = [[0,0,0],[0,0,0],[0,0,0]]

n = int(input())
st = set()
for _ in range(n):
    st.add(int(input()))

for _ in range(len(st)):
    for i in range(3):
        for j in range(3):
            if bingo[i][j] in st:
                cl[i][j] = 1

if sum(cl[0]) == 3 or sum(cl[1]) == 3 or sum(cl[2]) == 3:
    print('Yes')
elif sum(cl[:][0]) == 3 or sum(cl[:][1]) == 3 or sum(cl[:][2]) == 3:
    print('Yes')
elif cl[0][0]+cl[1][1]+cl[2][2] == 3 or cl[0][2]+cl[1][1]+cl[0][2] == 3:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

cl = [[0,0,0],[0,0,0],[0,0,0]]

n = int(input())
st = set()
for _ in range(n):
    st.add(int(input()))

for _ in range(len(st)):
    for i in range(3):
        for j in range(3):
            if bingo[i][j] in st:
                cl[i][j] = 1

if sum(cl[0]) == 3 or sum(cl[1]) == 3 or sum(cl[2]) == 3:
    print('Yes')
elif sum(cl[:][0]) == 3 or sum(cl[:][1]) == 3 or sum(cl[:][2]) == 3:
    print('Yes')
elif cl[0][0]+cl[1][1]+cl[2][2] == 3 or cl[0][2]+cl[1][1]+cl[0][2]:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

cl = [[0]*3]*3

n = int(input())
st = set()
for _ in range(n):
    st.add(int(input()))

for _ in range(len(st)):
    for i in range(3):
        for j in range(3):
            if bingo[i][j] in st:
                cl[i][j] = 1

if sum(cl[0]) == 3 or sum(cl[1]) == 3 or sum(cl[2]) == 3:
    print('Yes')
elif sum(cl[:][0]) == 3 or sum(cl[:][1]) == 3 or sum(cl[:][2]) == 3:
    print('Yes')
elif cl[0][0]+cl[1][1]+cl[2][2] == 3 or cl[0][2]+cl[1][1]+cl[0][2]:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np
bingo_bool=[[False for i in range(3)] for j in range(3)]
bingo_number=[]
for _ in range(3):
    bingo_number.append(list(map(int,input().split())))
N=int(input())
bingo_number = np.array(bingo_number)
#print(bingo_number)
for _ in range(N):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if b == bingo_number[i][j]:
                # print("{}, {}|{}".format(i,j,b))
                bingo_bool[i][j] = True
                # print(bingo_bool)


bingo_bool = np.array(bingo_bool)

for i in range(3):
    if (all(bingo_bool[i]) or
    all(bingo_bool[:][i]) or
    all([bingo_bool[0][0],bingo_bool[1][1],bingo_bool[2][2]]) or
    all([bingo_bool[2][0],bingo_bool[1][1],bingo_bool[0][2]])):
        print("Yes")
        break
    else:
        print("No")
        break

Submission status: Wrong Answer

Solution code:
import numpy as np
bingo_bool=[[False for i in range(3)] for j in range(3)]
bingo_number = []
for _ in range(3):
    bingo_number.append(list(map(int,input().split())))
N=int(input())
#print(bingo_number)
for _ in range(N):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if b == bingo_number[i][j]:
                # print("{}, {}|{}".format(i,j,b))
                bingo_bool[i][j] = True
                # print(bingo_bool)
            else:
                continue

bingo_bool = np.array(bingo_bool)

for i in range(3):
    if (all(bingo_bool[i]) or
    all(bingo_bool[:][i]) or
    all([bingo_bool[0][0],bingo_bool[1][1],bingo_bool[2][2]]) or
    all([bingo_bool[2][0],bingo_bool[1][1],bingo_bool[0][2]])):
        print("Yes")
        break
    else:
        print("No")
        break

Submission status: Wrong Answer

Solution code:
bingo_bool=[[False for i in range(3)] for j in range(3)]
bingo_number = []
for _ in range(3):
    bingo_number.append(list(map(int,input().split())))
N=int(input())
# print(bingo_number)
for _ in range(N):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if b == bingo_number[i][j]:
                # print("{}, {}|{}".format(i,j,b))
                bingo_bool[i][j] = True
                # print(bingo_bool)
            else:
                continue



for i in range(3):
    if (all(bingo_bool[i]) or
    all(bingo_bool[:][i]) or
    all([bingo_bool[0][0],bingo_bool[1][1],bingo_bool[2][2]]) or
    all([bingo_bool[2][0],bingo_bool[1][1],bingo_bool[0][2]])):
        print("Yes")
        break
    else:
        print("No")
        break

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)]
a_hash = [[False, False, False] for _ in range(3)]

for i in b:
    for ind, j in enumerate(a):
        if i in j:
            a_hash[ind][j.index(i)] = True

for i in a_hash:
    if all(i):
        print("Yes")
        exit()

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

for num in range(3):
    if a_hash[num][0] and a_hash[num][1] and a_hash[num][2]:
        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)]
a_hash = [[False, False, False] for _ in range(3)]

for i in b:
    for ind, j in enumerate(a):
        if i in j:
            a_hash[ind][j.index(i)] = True

for i in a_hash:
    if all(i):
        print("Yes")
        exit()
for num in range(3):
    if a_hash[num][0] and a_hash[num][1] and a_hash[num][2]:
        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())

for _ in range(n):
  b = int(input())
  for y in range(3):
    for x in range(3):
      if a[y][x] == b:
        a[y][x] = -1

for y in range(3):
  f = True
  for x in range(3):
    if a[y][x] != -1:
      f = False
  if f:
    print('Yes')
    exit()
    
for x in range(3):
  f = True
  for y in range(3):
    if a[y][x] != -1:
      f = False
  if f:
    print('Yes')
    exit()
    
f = True
for x in range(3):
  if a[x][x] != -1:
    f = False
if f:
  print('Yes')
  exit()
  
print('No')

Submission status: Wrong Answer

Solution code:
a = []
a.append(input().split())
a.append(input().split())
a.append(input().split())
n = int(input())

for i in range(n):
  b = input()
  for j in range(3):
    for k in range(3):
      if a[j][k] == b:
        a[j][k] = "0"
        break
    else:
      continue
    break
print(a)

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

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

print("No")

Submission status: Wrong Answer

Solution code:
A1,A2,A3 = map(int, input().split())
A4,A5,A6 = map(int, input().split())
A7,A8,A9 = map(int, input().split())
N = int(input())
B = []
for _ in range(N):
    B.append(int(input()))
if A1 in B and A2 in B and A3 in B:
  print('Yes')
elif A4 in B and A5 in B and A6 in B:
  print('Yes')
elif A7 in B and A8 in B and A9 in B:
  print('Yes')
elif A1 in B and A4 in B and A7 in B:
  print('Yes')
elif A2 in B and A5 in B and A8 in B:
  print('Yes')
elif A1 in B and A5 in B and A9 in B:
  print('Yes')
elif A3 in B and A5 in B and A7 in B:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
A = []
for _ in range(3):
  A += list(map(int, input().split()))
N = int(input())
res = "No"

for _ in range(N):
  b = int(input())
  if b in A:
    ind = A.index(b)
    A[ind] = -1
if any(all(a==-1 for a in A[3*i:i+3])for i in range(3)): res = "Yes"
if any(all(a==-1 for a in A[i::3])for i in range(3)): res = "Yes"
if any(all(A[i]==-1 for i in a)for a in [[0,4,8],[2,4,6]]): res = "Yes"
print(res)

Submission status: Wrong Answer

Solution code:
A = []
for _ in range(3):
  A += list(map(int, input().split()))
N = int(input())
res = "No"

for _ in range(N):
  b = int(input())
  if b in A:
    ind = A.index(b)
    A[ind] = -1
if any(all(a==-1 for a in A[i:i+3])for i in range(3)): res = "Yes"
if any(all(a==-1 for a in A[i::3])for i in range(3)): res = "Yes"
if any(all(A[i]==-1 for i in a)for a in [[0,4,8],[2,4,6]]): res = "Yes"
print(res)

Submission status: Wrong Answer

Solution code:
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


A = [[0 for _ in range(3)] for _ in range(3)]

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

n = int(input())
for i in range(n):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if A[j][k] == b:
                A[j][k] = - 1

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

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

c = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]

for b in B:
    for i in range(3):
        for j in range(3):
            if b == a[i][j]:
                c[i][j] += 1

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

for i in range(3):
    if sum(c[i]) == 3:
        print('Yes')
        exit()

cnt = 0
for i in range(3):
    for j in range(3):
        if c[j][i] == 1:
            cnt += 1
        if cnt == 3:
            print('Yes')
            exit()

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

print('No')

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 = A + B + C
N = int(input())
L = []
for i in range (N):
  K = int(input())
  L.append(K)
ck = 'No'
if A[0] in L and A[1]in L and A[2] in L:
  ck == 'Yes'
elif B[0] in L and B[1]in L and B[2] in L:
  ck == 'Yes'
elif C[0] in L and C[1]in L and C[2] in L:
  ck == 'Yes'
elif A[0] in L and B[0]in L and C[0] in L:
  ck == 'Yes'
elif A[1] in L and B[1]in L and C[1] in L:
  ck == 'Yes'
elif A[2] in L and B[2]in L and C[2] in L:
  ck == 'Yes'
elif A[0] in L and B[1] in L and C[2] in L:
  ck = 'Yes'
elif A[2] in L and B[1] in L and C[0] in L:
  ck = 'Yes'
print(ck)

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=a+b+c
n=int(input())
ans='No'
for _ in range(n):
  s=int(input())
  x=['x' if i==s else i for i in x]
if x[0]==x[3]==x[6]=='x':ans='Yes'
elif x[1]==x[4]==x[7]=='x':ans='Yes'
elif x[2]==x[5]==x[8]=='x':ans='Yes'
elif x[0]==x[1]==x[2]=='x':ans='Yes'
elif x[3]==x[4]==x[5]=='x':ans='Yes'
elif x[6]==x[7]==x[8]=='x':ans='Yes'
elif x[0]==x[4]==x[8]=='x':ans='Yes'
elif x[2]==x[4]==x[7]=='x':ans='Yes'
print(ans)

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=a+b+c
n=int(input())
ans='No'
for _ in range(n):
  s=int(input())
  x=['x' if i==s else i for i in x]
if x[0]==x[3]==x[6]:ans='Yes'
if x[1]==x[4]==x[7]:ans='Yes'
if x[2]==x[5]==x[8]:ans='Yes'
if x[0]==x[1]==x[2]:ans='Yes'
if x[3]==x[4]==x[5]:ans='Yes'
if x[6]==x[7]==x[8]:ans='Yes'
if x[0]==x[4]==x[8]:ans='Yes'
if x[2]==x[4]==x[7]:ans='Yes'
print(ans)