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 mark(number):
    """ビンゴシートにマークする

    Parameters
    ----------
    number : int
        出た数字
    """
    if number in yoko1:
        yoko1[number] = True

    if number in yoko2:
        yoko2[number] = True

    if number in yoko3:
        yoko3[number] = True

    if number in tate1:
        tate1[number] = True

    if number in tate2:
        tate2[number] = True

    if number in tate3:
        tate3[number] = True

    if number in naname1:
        naname1[number] = True

    if number in naname2:
        naname2[number] = True


def is_bingo():
    """ビンゴ達成したか否かを返す。
    """
    ans_list = []
    ans_list.append(False not in yoko1.values())
    ans_list.append(False not in yoko2.values())
    ans_list.append(False not in yoko3.values())
    ans_list.append(False not in tate1.values())
    ans_list.append(False not in tate2.values())
    ans_list.append(False not in tate3.values())
    ans_list.append(False not in naname1.values())
    ans_list.append(False not in naname2.values())

    return True in ans_list


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

yoko1 = {row1[0]: False, row1[1]: False, row1[2]: False}
yoko2 = {row2[0]: False, row2[1]: False, row2[2]: False}
yoko3 = {row3[0]: False, row3[1]: False, row3[2]: False}

tate1 = {row1[0]: False, row2[0]: False, row3[0]: False}
tate2 = {row1[1]: False, row2[2]: False, row3[1]: False}
tate3 = {row1[2]: False, row2[2]: False, row3[2]: False}

naname1 = {row1[0]: False, row2[1]: False, row3[2]: False}
naname2 = {row1[2]: False, row2[1]: False, row3[0]: False}

N = int(input())

for i in range(N):
    b = int(input())
    mark(b)

print("Yes") if is_bingo() else print("No")

Submission status: Wrong Answer

Solution code:
a=[[0]*3 for i in range(3)]
b=[]
for i in range(3):
  x=input().split()
  a[i][0]=x[0]
  a[i][1]=x[1]
  a[i][2]=x[2]
n=int(input())
for i in range(n):
  b.append(input())
for i in range(n):
  for j in range(9):
    if b[i]==a[j//3][j%3]:
      a[j//3][j%3]='X'
jud=[0,0,0,0]
z=0
for i in range(3):
  for j in range(2):
    if a[i][j]==a[i][j+1]:
      jud[0]+=1
    if a[j][i]==a[j+1][i]:
      jud[1]+=1
    if a[j][j]==a[j+1][j+1]:
      jud[2]+=1
    if a[j][2-j]==a[j+1][2-j-1]:
      jud[3]+=1
  if max(jud)>1:
    print('Yes')
    break
  else:
    z+=1
if z==3:
  print('No')

Submission status: Wrong Answer

Solution code:
a=[[0]*3 for i in range(3)]
b=[]
for i in range(3):
  x=input().split()
  a[i][0]=x[0]
  a[i][1]=x[1]
  a[i][2]=x[2]
n=int(input())
for i in range(n):
  b.append(input())
for i in range(n):
  for j in range(9):
    if b[i]==a[j//3][j%3]:
      a[j//3][j%3]='X'
jud=[0,0,0,0]
z=0
for i in range(3):
  for j in range(2):
    if a[i][j]==a[i][j+1]:
      jud[0]+=1
    if a[j][i]==a[j+1][i]:
      jud[1]+=1
    if a[j][j]==a[j+1][j+1]:
      jud[2]+=1
    if a[j][2-i]==a[j+1][2-i]:
      jud[3]+=1
  if max(jud)>1:
    print('Yes')
    break
  else:
    z+=1
if z==3:
  print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np

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

N = int(input());

#Bの配列を作成
B = [];
for i in range(N):
  b = int(input())
  B.append(b);

#ビンゴの行列を作成
A = np.hstack([A1,A2,A3]);

for i in range(N):
  for j in range(len(A)):
    if B[i] == A[j]:
      A[j] = 0;
      break;
    else:
      pass;


if A[0] == 0 and A[1] == 0 and A[2] == 0:
  print("Yes");
elif A[3] == 0 and A[4] == 0 and A[5] == 0:
  print("Yes");
elif A[6] == 0 and A[7] == 0 and A[8] == 0:
  print("Yes");
elif A[0] == 0 and A[3] == 0 and A[6] == 0:
  print("Yes");
elif A[1] == 0 and A[4] == 0 and A[7] == 0:
  print("Yes");
elif A[2] == 0 and A[5] == 0 and A[8] == 0:
  print("Yes");
elif A[0] == 0 and A[4] == 0 and A[7] == 0:
  print("Yes");
elif A[2] == 0 and A[4] == 0 and A[6] == 0:
  print("Yes");
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][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:
#!/usr/bin/env python3

def main():
    *N, = map(int, open(0).read().split())
    A = N[0:9]
    N_number = N[9]
    b = N[10:]

    Ab_comm = set(A) & set(b)
    A_rep = [0 if i in Ab_comm else i for i in A]

    Ax=[]
    Ay=[]
    for i in range(0,3):
        Ax.append(A_rep[i] + A_rep[i + 1] + A_rep[i + 2])
        Ay.append(A_rep[i] + A_rep[i + 3] + A_rep[i + 6])
    An=[]
    An.append(A_rep[0] + A_rep[4] + A_rep[8])
    An.append(A_rep[2] + A_rep[4] + A_rep[6])
    if min(Ax + Ay + An) == 0:
        print("Yes")
    else:
        print("No")
        

main()

Submission status: Wrong Answer

Solution code:
a = [list(map(int,input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _1 in range(n)]
for bingo in b:
    for i in range(3):
        for j in range(3):
            if a[i][j] == bingo:
                a[i][j] = 0
triple_pair =[a[0][t1]+a[1][t1]+a[2][t1] for t1 in range(3)] + [a[t2][0]+a[t2][1]+a[t2][2] for t2 in range(3)] + [a[0][0]+a[1][1]+a[2][2]] + [a[0][2]+a[2][2]+a[2][0]]
if 0 in triple_pair:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a = []
for _ in range(3):
    a.append(list(map(int,input().split()))) 
n = int(input())
num_list = []
for _ in range(n):
    num_list.append(int(input()))
    
flg = False
for i in range(3):
    if a[i][0] in num_list and a[i][1] in num_list and a[i][2] in num_list:
        flg = True
        break
diago = list([a[0][0],a[1][1],a[2][2]])

if flg != True:
    if diago[0] in num_list and diago[1] in num_list and diago[2] in num_list:
        flg = True

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

Submission status: Wrong Answer

Solution code:
a = []
for _ in range(3):
    a.append(list(map(int,input().split()))) 
print(a)
n = int(input())
num_list = []
for _ in range(n):
    num_list.append(int(input()))
    
flg = False
for i in range(3):
    if a[i][0] in num_list and a[i][1] in num_list and a[i][2] in num_list:
        flg = True
        break
diago = list([a[0][0],a[1][1],a[2][2]])

if flg != True:
    if diago[0] in num_list and diago[1] in num_list and diago[2] in num_list:
        flg = True

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

Submission status: Wrong Answer

Solution code:
'''
INPUT SHORTCUTS
N, K = map(int,input().split())
N ,A,B = map(int,input().split())
string = str(input())
arr = list(map(int,input().split()))
N = int(input())
'''
grid = []
for _ in range(3):
	temp = []
	temp = list(map(int,input().split()))
	grid.append(temp)
N = int(input())
b = []
for _ in range(N):
	b.append(int(input()))
for x in b:
	for i in range(3):
		for j in range(3):
			if grid[i][j]==x:
				grid[i][j]= -(grid[i][j])
ans = -1
if not (grid[0][0]<0 and grid[1][1]<0 and grid[2][2]<0):	
	for i in range(3):
		if grid[i][0]<0 and grid[i][1]<0 and grid[i][2]<0:
			ans  = 1
			break
		elif(grid[0][i]<0 and grid[1][i]<0 and grid[2][i]<0):
			ans = 1
			break
else:
	ans =1 
if(ans ==1):
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
'''
INPUT SHORTCUTS
N, K = map(int,input().split())
N ,A,B = map(int,input().split())
string = str(input())
arr = list(map(int,input().split()))
N = int(input())
'''
grid = []
for _ in range(3):
	temp = []
	temp = list(map(int,input().split()))
	grid.append(temp)
N = int(input())
b = []
for _ in range(N):
	b.append(int(input()))
for x in b:
	for i in range(3):
		for j in range(3):
			if grid[i][j]==x:
				grid[i][j]= -(grid[i][j])
ans = -1
if not (grid[0][0]<0 and grid[1][1]<0 and grid[2][2]<0):	
	for i in range(3):
		if grid[i][0]<0 and grid[i][1]<0 and grid[i][2]<2:
			ans  = 1
			break
		elif(grid[0][i]<0 and grid[1][i]<0 and grid[2][i]<2):
			ans = 1
			break
else:
	ans =1 
if(ans ==1):
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

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

def main():
    N = map(int, open(0).read().split())


main()

Submission status: Wrong Answer

Solution code:
# AtCoder
A = [list(map(int, input().split())) for i 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
bingo = []
for i in range(3):
    for j in range(3):
        if A[i][j] == 0:

            bingo.append((i, j))
        if A[i] == [0, 0, 0]:
            print('Yes')
            exit()
    if ((0, 0) and (1, 0) and (2, 2) in bingo) or ((0, 2) and (1, 0)and (2, 0) in bingo):
        print('Yes')
        exit()

    if ((0, 0) and (1, 0) and (2, 0) in bingo) or ((0, 1) and (1, 1) and (2, 1) in bingo) or ((0, 2) and (1, 2) and (2, 2) in bingo):
        print('Yes')
        exit()


print('No')

Submission status: Wrong Answer

Solution code:
# AtCoder
A = [list(map(int, input().split())) for i 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
bingo = []
for i in range(3):
    for j in range(3):
        print(A[i][j])
        if A[i][j] == 0:
            bingo.append((i, j))
        if A[i] == [0, 0, 0]:
            print('Yes')
            exit()
    if (0, 0) and (1, 0) and (2, 2) in bingo or (0, 2) and (1, 0)and (2, 0) in bingo:
        print('Yes')
        exit()

    if (0, 0) and (1, 0) and (2, 0) in bingo or (0, 1) and (1, 1) and (2, 1) in bingo or (0, 2) and (1, 2) and (2, 2) in bingo:
        print('Yes')
        exit()


print('No')

Submission status: Wrong Answer

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

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

for i in range(3):
    bingo = []
    for j in range(3):
        if A[i][j] == 0:
            bingo.append((i, j))
        if A[i] == [0, 0, 0]:
            print('Yes')
            exit()

    # 斜め
    if [(0, 0), (1, 0), (2, 2)] or [(0, 2), (1, 0), (2, 0)] in bingo:
        print('Yes')
        exit()

    if [(0, 0), (1, 0), (2, 0)] or [(0, 1), (1, 1), (2, 1)] or [(0, 2), (1, 2), (2, 2)] in bingo:
        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()))
d = a + b + c
n = int(input())
n_list = [int(input()) for i in range(n)]
o = [False, False, False, False, False, False, False, False, False]
flag = False
for i in n_list:
    if i in d:
        o[d.index(i)] = True

for i in range(0, 3, 7):

    if o[i] and o[i + 1] and o[i + 2]:
        flag = True
        break

for i in range(0, 3):
    if o[i] and o[i + 3] and o[i + 6]:
        flag = True
        break

if o[0] and o[4] and o[8]:
    flag = True
if o[2] and o[4] and o[6]:
    flag = True

if flag:
    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()))
d = a + b + c
n = int(input())
n_list = [int(input()) for i in range(n)]
o = [0, 0, 0, 0, 0, 0, 0, 0, 0]
flag = False
for i in n_list:
    if i in d:
        o[d.index(i)] = 1

for i in range(0, 3, 7):

    if o[i] == 1 and o[i + 1] == 1 and o[i + 2] == 1:
        flag = True
        break

for i in range(0, 3):
    if o[i] == 1 and o[i + 3] == 1 and o[i + 6] == 1:
        flag = True
        break

if o[0] == 1 and o[4] == 1 and o[8] == 1:
    flag = True
if o[2] == 1 and o[4] == 1 and o[6] == 1:
    flag = True

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

a = [list(map(int, readline().split())) for i in range(3)]
n = int(readline())
b = [int(readline()) for _ in range(n)]
if a[0] in b or a[1] in b or a[2] in b:
    print('Yes')
elif a[0][0] in b and a[1][1] in b and a[2][2] in b:
    print('Yes')
elif a[0][0] in b and a[1][0] in b and a[2][0] in b:
    print('Yes')
elif a[0][1] in b and a[1][1] in b and a[2][1] in b:
    print('Yes')
elif a[0][2] in b and a[1][2] in b and a[2][2] in b:
    print('Yes')
elif a[0][2] in b and a[1][1] in b and a[2][0] in b:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

a = list(map(int, readline().split()))
d = list(map(int, readline().split()))
h = list(map(int, readline().split()))
n = int(readline())
bb = [int(readline()) for _ in range(n)]
if a[0] in bb and a[1] in bb and a[2] and bb:
    print('Yes')
elif d[0] in bb and d[1] in bb and d[2] in bb:
    print('Yes')
elif h[0] in bb and h[1] in bb and h[2] in bb:
    print('Yes')
elif a[0] in bb and d[0] in bb and h[0] in bb:
    print('Yes')
elif a[1] in bb and d[1] in bb and h[1] in bb:
    print('Yes')
elif a[2] in bb and d[2] in bb and h[2] in bb:
    print('Yes')
elif a[0] in bb and d[1] in bb and h[2] in bb:
    print('Yes')
elif a[2] in bb and d[1] in bb and h[0] in bb:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import sys

row1 = [int(n) for n in input().split()]
row2 = [int(n) for n in input().split()]
row3 = [int(n) for n in input().split()]

card = [row1,row2,row3]

#print(card)

N = int(input())
for n in range(N):
    bn = int(input())
    for i in range(len(card)):
        for j in range(len(card)):
            if card[i][j] == bn:
                card[i][j] = 0

#print(card)

for i in range(len(card)):
    check_i = 0
    for j in range(len(card)):
        check_i += card[i][j]
    #print('check_i: ' + str(check_i))
    if check_i == 0:
        print('Yes')
        sys.exit(0)
for j in range(len(card)):
    check_j = 0
    for i in range(len(card)):
        check_j += card[i][j]
    #print("check_j: " + str(check_j))
    if check_j == 0:
        print('Yes')
        sys.exit(0)

check_diag1 = 0
check_diag2 = 0
for i in range(len(card)):
    check_diag1 += card[i][i]
    check_diag2 += card[-i][i]
#print('check_diag1: ' + str(check_diag1))
#print('check_diag2: ' + str(check_diag2))
if check_diag1 == 0 or check_diag2 == 0:
    print('Yes')
    sys.exit(0)

print('No')

Submission status: Wrong Answer

Solution code:
import sys

row1 = [int(n) for n in input().split()]
row2 = [int(n) for n in input().split()]
row3 = [int(n) for n in input().split()]

card = [row1,row2,row3]

#print(card)

N = int(input())
for n in range(N):
    bn = int(input())
    for i in range(len(card)):
        for j in range(len(card)):
            if card[i][j] == bn:
                card[i][j] = 0

#print(card)

for i in range(len(card)):
    check_i = 0
    for j in range(len(card)):
        check_i += card[i][j]
    #print('check_i: ' + str(check_i))
    if check_i == 0:
        print('Yes')
        sys.exit(0)
for j in range(len(card)):
    check_j = 0
    for i in range(len(card)):
        check_j += card[i][j]
    #print("check_j: " + str(check_j))
    if check_j == 0:
        print('Yes')
        sys.exit(0)
for i in range(len(card)):
    check_diag1 = 0
    check_diag2 = 0
    check_diag1 += card[i][i]
    check_diag2 += card[-i][i]
#print('check_diag1: ' + str(check_diag1))
#print('check_diag2: ' + str(check_diag2))
if check_diag1 == 0 or check_diag2 == 0:
    print('Yes')
    sys.exit(0)

print('No')

Submission status: Wrong Answer

Solution code:
import sys

row1 = [int(n) for n in input().split()]
row2 = [int(n) for n in input().split()]
row3 = [int(n) for n in input().split()]

card = [row1,row2,row3]

N = int(input())
for n in range(N):
    bn = int(input())
    for i in range(len(card)):
        for j in range(len(card)):
            if card[i][j] == bn:
                card[i][j] = 0

#print(card)

for i in range(len(card)):
    for j in range(len(card)):
        check_i = 0
        check_i += card[i][j]
    #print('check_i: ' + str(check_i))
    if check_i == 0:
        print('Yes')
        sys.exit(0)
for j in range(len(card)):
    for i in range(len(card)):
        check_j = 0
        check_j += card[i][j]
    #print("check_j: " + str(check_j))
    if check_j == 0:
        print('Yes')
        sys.exit(0)
for i in range(len(card)):
    check_diag1 = 0
    check_diag2 = 0
    check_diag1 += card[i][i]
    check_diag2 += card[-i][i]
#print('check_diag1: ' + str(check_diag1))
#print('check_diag2: ' + str(check_diag2))
if check_diag1 == 0 or check_diag2 == 0:
    print('Yes')
    sys.exit(0)

print('No')

Submission status: Wrong Answer

Solution code:
import sys

row1 = [int(n) for n in input().split()]
row2 = [int(n) for n in input().split()]
row3 = [int(n) for n in input().split()]

card = [row1,row2,row3]

N = int(input())
for n in range(N):
    bn = int(input())
    for i in range(len(card)):
        for j in range(len(card)):
            if card[i][j] == bn:
                card[i][j] = 0

#print(card)

for i in range(len(card)):
    check_i = 0
    for j in range(len(card)):
        check_i += card[i][j]
    #print('check_i: ' + str(check_i))
    if check_i == 0:
        print('Yes')
        sys.exit(0)
for j in range(len(card)):
    check_j = 0
    for i in range(len(card)):
        check_j += card[i][j]
    #print("check_j: " + str(check_j))
    if check_j == 0:
        print('Yes')
        sys.exit(0)
for i in range(len(card)):
    check_diag1 = 0
    check_diag2 = 0
    check_diag1 += card[i][i]
    check_diag2 += card[-i][i]
#print('check_diag1: ' + str(check_diag1))
#print('check_diag2: ' + str(check_diag2))
if check_diag1 == 0 or check_diag2 == 0:
    print('Yes')
    sys.exit(0)

print('No')

Submission status: Wrong Answer

Solution code:
import sys

row1 = [int(n) for n in input().split()]
row2 = [int(n) for n in input().split()]
row3 = [int(n) for n in input().split()]

card = [row1,row2,row3]

N = int(input())
for n in range(N):
    bn = int(input())
    for i in range(len(card)):
        for j in range(len(card)):
            if card[i][j] == bn:
                card[i][j] = 0

for i in range(len(card)):
    check_i = 0
    for j in range(len(card)):
        check_i += card[i][j]
    if check_i == 0:
        print('Yes')
        sys.exit(0)
for j in range(len(card)):
    check_j = 0
    for i in range(len(card)):
        check_j += card[i][j]
    if check_j == 0:
        print('Yes')
        sys.exit(0)
for i in range(len(card)):
    check_diag1 = 0
    check_diag2 = 0
    check_diag1 += card[i][i]
    check_diag2 += card[-i][i]
    if check_diag1 == 0 or check_diag2 == 0:
        print('Yes')
        sys.exit(0)

print('No')

Submission status: Wrong Answer

Solution code:
import math
A=[list(map(int,input().split())) for n in range(3)]
N=int(input())
D=[int(input()) for i in range(N)]
F=[]
ans="No"
for d in D:
    for aa in A:
        for a in aa:
            if d==a:
               F.append([A.index(aa)+1,aa.index(d)+1])
            else:
                continue

for f1 in F:
    for f2 in F:
        for f3 in F:
            if f1==f2 or f2==f3 or f3==f1:
                continue
            elif math.atan2(f1[0],f1[1])==math.atan2(f2[0],f2[1])==math.atan2(f3[0],f3[1]):
                ans="Yes"
                break
            else:
                continue

print(ans)

Submission status: Wrong Answer

Solution code:
A=[list(map(int,input().split())) for n in range(3)]
N=int(input())
D=[int(input()) for i in range(N)]
F=[]
ans="No"
for d in D:
    for aa in A:
        for a in aa:
            if d==a:
               F.append([A.index(aa)+1,aa.index(d)+1])
            else:
                continue

for f1 in F:
    for f2 in F:
        for f3 in F:
            if f1==f2 or f2==f3 or f3==f1:
                continue
            elif (f1[0]/f1[1])==(f2[0]/f2[1])==(f2[0]/f2[1])==(f3[0]/f3[1]):
                ans="Yes"
                break
            elif f1[0]==f2[0]==f3[0] or f1[1]==f2[1]==f3[1]:
                ans="Yes"
                break
            else:
                continue

print(ans)

Submission status: Wrong Answer

Solution code:
A=[list(map(int,input().split())) for n in range(3)]
N=int(input())
D=[int(input()) for i in range(N)]
F=[]
ans="No"
for d in D:
    for aa in A:
        for a in aa:
            if d==a:
               F.append([A.index(aa)+1,aa.index(d)+1])
            else:
                continue

for f1 in F:
    for f2 in F:
        for f3 in F:
            if f1==f2 or f2==f3 or f3==f1:
                continue
            elif (f1[0]/f1[1])==(f2[0]/f2[1]) and (f2[0]/f2[1])==(f3[0]/f3[1]):
                ans="Yes"
                break
            else:
                continue

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
from io import StringIO
import unittest

import numpy as np

def resolve():
    a = np.array([list(map(int, input().split())) for _ in range(3)])
    n = int(input())
    b = set([int(input()) for _ in range(n)])
    flag = 0

    for i in range(3):
        if set(a[i]).issubset(b) or set(a[:, i]).issubset(b):
            flag = 1
            break

    if set([a[0][0], a[1][1], a[2][2]]).issubset(b):
        flag = 1

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



class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """84 97 66
79 89 11
61 59 7
7
89
7
87
79
24
84
30"""
        output = """Yes"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """41 7 46
26 89 2
78 92 8
5
6
45
16
57
17"""
        output = """No"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """60 88 34
92 41 43
65 73 48
10
60
43
88
11
48
73
65
41
92
34"""
        output = """Yes"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Wrong Answer

Solution code:
import sys
from io import StringIO
import unittest

import numpy as np

def resolve():
    a = np.array([list(map(int, input().split())) for _ in range(3)])
    n = int(input())
    b = set([int(input()) for _ in range(n)])
    flag = 0

    for i in range(3):
        if set(a[i]).issubset(b) or set(a[:, i]).issubset(b):
            flag = 1
            break

    if set([a[0][0], a[1][1], a[2][2]]).issubset(b):
        flag = 1

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



class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """84 97 66
79 89 11
61 59 7
7
89
7
87
79
24
84
30"""
        output = """Yes"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """41 7 46
26 89 2
78 92 8
5
6
45
16
57
17"""
        output = """No"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """60 88 34
92 41 43
65 73 48
10
60
43
88
11
48
73
65
41
92
34"""
        output = """Yes"""
        self.assertIO(input, output)

if __name__ == "__main__":
    unittest.main()
    # resolve()

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys

cnt = 0
lst = np.array([[int(e) for e in input().split(" ")]for i in range(3)])
N = int(input())
b = np.array([int(input()) for i in range(N)])
lst2 = [-1,-1,-1]


for i in range(len(b)):
    for e in range(len(lst)):
        for j in range(len(lst[e])):
            if b[i] == lst[e][j]:
                lst[e][j] = -1


for lst1 in lst:
    if all(lst1 == lst2):
        print('Yes')
        sys.exit()


for i in range(len(lst)):
    for j in range(3):
        if lst[i][j] == -1:
            cnt = cnt + 1
        if cnt == 3:
            print('Yes')
            sys.exit()

cnt = 0

for i in range(len(lst)):
    if lst[i][i] == -1:
        cnt = cnt + 1
    if cnt == 3:
        print('Yes')
        sys.exit()

cnt = 0

for i in range(len(lst)):
    if lst[i][len(lst) - 1 - i] == -1:
        cnt = cnt + 1
    if cnt == 3:
        print('Yes')
        sys.exit()

print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np

sheet=[input().split() for l in range(3)]
n=int(input())
b=[input() for i in range(n)]
a=np.array(sheet)
i,j,k,c,z=0,0,0,0,0

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


if a[0][0]==a[1][1]==a[2][2]=="x":
    c+=1

if a[0][2]==a[1][1]==a[2][0]=="x":
    c+=1

for z in range(3):
    if a[0][z]==a[1][z]==a[2][z]=="x":
        c+=1
    if a[z][0]==a[z][1]==a[z][1]=="x":
        c+=1
if c!=0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import numpy as np

sheet=[input().split() for l in range(3)]
n=int(input())
b=[input() for i in range(n)]
a=np.array(sheet)
i,j,k,c,z=0,0,0,0,0

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


if a[0][0]==a[1][1]==a[2][2]=="x":
    c+=1

if a[0][2]==a[1][1]==a[2][0]=="x":
    c+=1

for z in range(3):
    if a[0][z]==a[1][z]==a[2][z]=="x":
        c+=1

if c!=0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
A = [list(map(int, input().split())) for k in range(3)]
n = int(input())
B = [int(input()) for b in range(n)]
#print(A, B)

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

J_0 = A[0][0] + A[1][0] + A[2][0]
J_1 = A[0][1] + A[1][1] + A[2][1]
J_2 = A[0][2] + A[1][2] + A[2][2]
nana = A[0][0] + A[1][1] + A[2][2]
if sum(A[0]) == 0 or sum(A[1]) == 0 or sum(A[2]) == 0:
    print("Yes")
elif J_0 == 0 or J_1 == 0 or J_2 == 0:
    print("Yes")
elif nana == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
A = [list(map(int, input().split())) for k in range(3)]
n = int(input())
B = [int(input()) for b in range(n)]
#print(A, B)

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

J_0 = A[0][0] + A[1][0] + A[2][0]
J_1 = A[0][1] + A[1][1] + A[2][1]
J_2 = A[0][2] + A[1][2] + A[2][2]
nana = A[0][0] + A[1][1] + A[2][2]
if sum(A[0]) == 0 or sum(A[1]) == 0 or sum(A[2]) == 0 or J_0 == 0 or J_1 == 0 or J_2 == 0 or nana == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
A = [list(map(int, input().split())) for k in range(3)]
n = int(input())
B = [int(input()) for k in range(n)]
#print(A, B)

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

J_0 = A[0][0] + A[1][0] + A[2][0]
J_1 = A[0][1] + A[1][1] + A[2][1]
J_2 = A[0][2] + A[1][2] + A[2][2]
nana = A[0][0] + A[1][1] + A[2][2]
if sum(A[0]) == 0 or sum(A[1]) == 0 or sum(A[2]) == 0 or  J_0 == 0 or J_1 ==0 or J_2 == 0 or nana == 0:
    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())
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 = 0
for i in range(3):
    if sum(a[i]) == 0:
        ans+=1
    if sum([a[j][i] for j in range(j)]) == 0:
        ans+=1
if a[0][0]+a[1][1]+a[2][2]==0:
     ans +=1
if a[2][0]+a[1][1]+a[0][2]==0:
     ans +=1
print('Yes' if ans > 0 else '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)]
judge = 0

for i in range(3):
  for j in range(3):
    if A[i][j] in b:
      A[i][j] = 0
  
for i in range(3):
  if A[i][0] + A[i][1] + A[i][2] == 0 or A[0][i] + A[1][i] + A[2][i] == 0 or A[0][0]+A[1][1]+A[2][2] ==0 or A[2][0]+A[1][1]+A[0][2] ==0:
    judge += 1
    break
  
  else:
    judge += 0
    break
    
if judge >= 1:
  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):
    if A[i][j] in b:
      A[i][j] = 0
  
for i in range(3):
  if A[i][0] + A[i][1] + A[i][2] == 0 or A[0][i] + A[1][i] + A[2][i] == 0 or A[0][0]+A[1][1]+A[2][2] ==0 or A[2][0]+A[1][1]+A[0][2] ==0:
    print('Yes')
    break
  
  else:
    print('No')
    break