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 isBingo(a):
    for i in range(3):
        if a[i][0] == a[i][1] and a[i][0] == a[i][2]:
            return 'Yes'
        elif a[0][i] == a[1][i] and a[i][0] == a[2][i]:
            return 'Yes'
    if a[0][0] == a[1][1] and a[0][0] == a[2][2]:
        return 'Yes'
    else:
        return 'No'
    
a = []
for i in range(3):
    a.append(list(map(int, input().split())))
n = int(input())
b = []
for i in range(n):
    b.append(int(input()))

for i in range(n):
    for j in range(3):
        if b[i] in a[j]:
            a[j][a[j].index(b[i])] = -1

print(isBingo(a))

Submission status: Wrong Answer

Solution code:
a11, a12, a13 = map(int, input().split())
a21, a22, a23 = map(int, input().split())
a31, a32, a33 = map(int, input().split())
N = int(input())
num = []
for _ in range(N):
  num.append(int(input()))

row1 = a11 + a12 + a13
row2 = a21 + a22 + a23
row3 = a31 + a32 + a33
col1 = a11 + a21 + a31
col2 = a12 + a22 + a32
col3 = a13 + a23 + a33
cross1 = a11 + a22 + a33
cross2 = a13 + a22 + a31

if 0 in [row1, row2, row3, col1, col2, col3, cross1, cross2]:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import numpy as np
import itertools
A = np.array([[0]*3 for i in range(3)])
for i in range(3):
    A[i] = list(map(int, input().split()))
    
N = int(input())

b = np.array([0]*N)
for i in range(N):
    b[i] = int(input())
    
arr = np.array([[0]*3 for i in range(3)])

for i, x, y in itertools.product(range(N), range(3), range(3)):
    if A[x][y] == b[i]:
        arr[x][y] = 1

flag = False
for i in range(3):
    if sum(arr[i]) == 3:
        flag = True

for i in range(3):
    if sum(arr[:,0]) == 3:
        flag = True
        
if arr[0][0] + arr[1][1] + arr[2][2] == 3:
    flag = True

if arr[0][2] + arr[1][1] + arr[2][0] == 3:
    flag = True
    
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
a11, a12, a13 = map(int, input().split())
a21, a22, a23 = map(int, input().split())
a31, a32, a33 = map(int, input().split())

N = int(input())

bingo = [a11, a12, a13, a21, a22, a23, a31, a32, a33]

num = []
for _ in range(N):
  num.append(_)

for _ in range(len(bingo)):
  if bingo[_] in num:
    bingo[_] = 0

row1 = a11 + a12 + a13
row2 = a21 + a22 + a23
row3 = a31 + a32 + a33
col1 = a11 + a21 + a31
col2 = a12 + a22 + a32
col3 = a13 + a23 + a33
cross1 = a11 + a22 + a33
cross2 = a13 + a22 + a31

if 0 in [row1, row2, row3, col1, col2, col3, cross1, cross2]:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

s = set()
n = int(input())
for i in range(0,n):
    s.add(int(input()))

for i in range(0,3):
    for j in range(0,3):
        if a[i][j] in s:
            b[i][j] = 1
        else:
            b[i][j] = 0
            
b1 = b[0][0]*b[0][1]*b[0][2]
b2 = b[1][0]*b[1][1]*b[1][2]
b3 = b[2][0]*b[2][1]*b[2][2]
b4 = b[0][0]*b[1][0]*b[2][0]
b5 = b[0][1]*b[1][1]*b[2][1]
b6 = b[0][2]*b[1][2]*b[2][2]
b7 = b[0][0]*b[1][1]*b[2][2]
b8 = b[2][0]*b[1][1]*b[0][2]

if (b1 or b2 or b3 or b4 or b5 or b6 or b7 or b8) == 1:
	print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
date = []
dict = {}
flag = 0
for i in range(3):
    temp = [int(j) for j in input().split()]
    date.append(temp)
N = int(input())

for i in date:
    for j in i:
        dict[j] = 0

for i in  range(N):
    m = int(input())
    for j in date:
        if m in j:
            dict[m] = 1
index = list(dict.values())
li = []
li.append(index[0:3])
li.append(index[3:6])
li.append(index[6:9])
if li[0][0] == 1 and li[0][1]==1 and li[0][2]==1:
    flag = 1
if li[1][0] == 1 and li[1][1]==1 and li[1][2]==1:
    flag = 1
if li[2][0] == 1 and li[2][1]==1 and li[2][2]==1:
    flag = 1
if li[0][0] == 1 and li[1][0]==1 and li[2][0]==1:
    flag = 1
if li[0][1] == 1 and li[1][1]==1 and li[2][1]==1:
    flag = 1
if li[0][2] == 1 and li[1][2]==1 and li[2][2]==1:
    flag = 1
if li[0][0] == 1 and li[1][1]==1 and li[2][2]==1:
    flag = 1
if li[0][2] == 1 and li[1][1]==1 and li[2][0]==1:
    flag = 1

if flag == 1:
    print("Yes",end="")
else:
    print("No",end="")

Submission status: Wrong Answer

Solution code:
date = []
dict = {}
flag = 0
for i in range(3):
    temp = [int(j) for j in input().split()]
    date.append(temp)
N = int(input())
for i in date:
    for j in i:
        dict[j] = 0

for i in  range(N):
    m = int(input())
    for j in date:
        if m in j:
            dict[m] = 1
index = list(dict.values())
li = []
li.append(index[0:3])
li.append(index[3:6])
li.append(index[6:9])

if li[0][0] == 1 and li[0][1]==1 and li[0][2]==1:
    flag = 1
if li[1][0] == 1 and li[1][1]==1 and li[1][2]==1:
    flag = 1
if li[2][0] == 1 and li[2][1]==1 and li[2][2]==1:
    flag = 1
if li[0][0] == 1 and li[1][0]==1 and li[2][0]==1:
    flag = 1
if li[0][1] == 1 and li[1][1]==1 and li[2][1]==1:
    flag = 1
if li[0][2] == 1 and li[1][2]==1 and li[2][2]==1:
    flag = 1
if li[0][0] == 1 and li[1][1]==1 and li[2][2]==1:
    flag = 1
if li[0][2] == 1 and li[1][1]==1 and li[2][0]==1:
    flag = 1

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

Submission status: Wrong Answer

Solution code:
date = []
dict = {}
flag = 0
for i in range(3):
    temp = [int(j) for j in input().split()]
    date.append(temp)
N = int(input())

for i in date:
    for j in i:
        dict[j] = 0

for i in  range(N):
    m = int(input())
    for j in date:
        if m in j:
            dict[m] = 1
index = list(dict.values())
li = []
li.append(index[0:3])
li.append(index[3:6])
li.append(index[6:9])

if li[0][0] == 1 and li[0][1]==1 and li[0][2]==1:
    flag = 1
if li[1][0] == 1 and li[1][1]==1 and li[1][2]==1:
    flag = 1
if li[2][0] == 1 and li[2][1]==1 and li[2][2]==1:
    flag = 1
if li[0][0] == 1 and li[1][0]==1 and li[2][0]==1:
    flag = 1
if li[0][1] == 1 and li[1][1]==1 and li[2][1]==1:
    flag = 1
if li[0][2] == 1 and li[1][2]==1 and li[2][2]==1:
    flag = 1
if li[0][0] == 1 and li[1][1]==1 and li[2][2]==1:
    flag = 1
if li[0][2] == 1 and li[1][1]==1 and li[2][0]==1:
    flag = 1

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

Submission status: Wrong Answer

Solution code:

date = []
dict = {}
flag = 0
for i in range(3):
    temp = [int(j) for j in input().split()]
    date.append(temp)
N = int(input())

for i in date:
    for j in i:
        dict[j] = 0

for i in  range(N):
    m = int(input())
    for j in date:
        if m in j:
            dict[m] = 1
index = list(dict.values())
li = []
li.append(index[0:3])
li.append(index[3:6])
li.append(index[6:9])
print(li)
if li[0][0] == 1 and li[0][1]==1 and li[0][2]==1:
    flag = 1
if li[1][0] == 1 and li[1][1]==1 and li[1][2]==1:
    flag = 1
if li[2][0] == 1 and li[2][1]==1 and li[2][2]==1:
    flag = 1
if li[0][0] == 1 and li[1][0]==1 and li[2][0]==1:
    flag = 1
if li[0][1] == 1 and li[1][1]==1 and li[2][1]==1:
    flag = 1
if li[0][2] == 1 and li[1][2]==1 and li[2][2]==1:
    flag = 1
if li[0][0] == 1 and li[1][1]==1 and li[2][2]==1:
    flag = 1
if li[0][2] == 1 and li[1][1]==1 and li[2][0]==1:
    flag = 1

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

Submission status: Wrong Answer

Solution code:
#標準入力
a = []
for i in range(3):
    a2 = list(map(int,input().split()))
    a.append(a2)
n = int(input())
c = [0 for i in range(8)]
ok = False
#実際の処理
for i in range(n):
    b = int(input())
    #縦の判定
    for j in range(3):
        for k in range(3):
            if a[j][k] == b:
                c[j] += 1
                
    #横の判定
    for k in range(3):
        for j in range(3):
            if a[j][k] == b:
                c[k+3] +=1
                
    #斜め二通りの判定
    for l in range(3):
        if a[l][l] == b:
            c[6] += 1

    for m in range(3):
        if a[m][m-2] == b:
            c[7] += 1
#print(c)
if str(3) in str(c):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
date = []
dict = {}
flag = 0
for i in range(3):
    temp = [int(j) for j in input().split()]
    date.append(temp)
N = int(input())

for i in date:
    for j in i:
        dict[j] = 0

for i in  range(N):
    m = int(input())
    for j in date:
        if m in j:
            dict[m] = 1
index = list(dict.values())
li = []
li.append(index[0:3])
li.append(index[3:6])
li.append(index[6:9])
if li[0][0] == 1 and li[0][1]==1 and li[0][2]==1:
    flag = 1
if li[1][0] == 1 and li[1][1]==1 and li[1][2]==1:
    flag = 1
if li[2][0] == 1 and li[2][1]==1 and li[2][2]==1:
    flag = 1
if li[0][0] == 1 and li[1][0]==1 and li[2][0]==1:
    flag = 1
if li[0][1] == 1 and li[1][1]==1 and li[2][1]==1:
    flag = 1
if li[0][2] == 1 and li[1][2]==1 and li[2][2]==1:
    flag = 1
if li[0][0] == 1 and li[1][1]==1 and li[2][2]==1:
    flag = 1
if li[0][2] == 1 and li[1][1]==1 and li[2][2]==1:
    flag = 1

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

Submission status: Wrong Answer

Solution code:
#標準入力
a = []
for i in range(3):
    a2 = list(map(int,input().split()))
    a.append(a2)
n = int(input())
c = [0 for i in range(4)]
ok = False
#実際の処理
for i in range(n):
    b = int(input())
    #縦の判定
    for j in range(3):
        for k in range(3):
            if a[j][k] == b:
                c[0] += 1
        if c[0] == 3:
            break
            ok = True
    if ok:
        break
    #横の判定
    for k in range(3):
        for j in range(3):
            if a[j][k] == b:
                c[1] += 1
        if c[1] == 3:
            break
            ok = True
    if ok:
        break
    #斜め二通りの判定
    for l in range(3):
        if a[l][l] == b:
            c[2] += 1

    for m in range(3):
        for k in range(0,3,-1):
            if a[m][k] == b:
                c[3] += 1
#print(c)
if str(3) in str(c):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
#標準入力
a = []
for i in range(3):
    a2 = list(map(int,input().split()))
    a.append(a2)
n = int(input())
c = [0 for i in range(4)]
ok = False
#実際の処理
for i in range(n):
    b = int(input())
    #縦の判定
    for j in range(3):
        for k in range(3):
            if a[j][k] == b:
                c[0] += 1
        if c[0] == 3:
            break
            ok = True
    if ok:
        break
    #横の判定
    for k in range(3):
        for j in range(3):
            if a[j][k] == b:
                c[1] += 1
        if c[1] >= 3:
            break
            ok = True
    if ok:
        break
    #斜め二通りの判定
    for l in range(3):
        if a[l][l] == b:
            c[2] += 1

    for m in range(3):
        for k in range(0,3,-1):
            if a[m][k] == b:
                c[3] += 1
#print(c)
if str(3) in str(c):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
date = []
dict = {}
flag = 0
for i in range(3):
    temp = [int(j) for j in input().split()]
    date.append(temp)
N = int(input())

for i in  range(N):
    m = int(input())
    for j in date:
        if m in j:
            dict[m] = 1
index = list(dict.keys())


if date[0][0] in index and date[0][2] in index:
    if date[0][1] in index:

            flag = 1
if date[0][0] in index and date[2][0] in index:
    if date[1][0] in index:
            flag = 1

if date[0][0] in index and date[2][2] in index:
    if date[1][1] in index:

            flag = 1
if date[2][0] in index and date[2][2] in index:
    if date[1][1] in index:

        flag = 1
if date[0][2] in index and date[2][2] in index:
    if date[1][1] in index:

        flag = 1
if date[0][1] in index and date[2][1] in index:
    if date[1][1] in index:

        flag = 1
if date[1][0] in index and date[1][2] in index:
    if date[1][1] in index:
        flag = 1

if date[2][0] in index and date[0][2] in index:
    if date[1][1] in index:
        flag = 1


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

Submission status: Wrong Answer

Solution code:
date = []
dict = {}
flag = 0
for i in range(3):
    temp = [int(j) for j in input().split()]
    date.append(temp)
N = int(input())

for i in  range(N):
    m = int(input())
    for j in date:
        if m in j:
            dict[m] = 1
index = list(dict.keys())


if date[0][0] in index and date[0][2] in index:
    if date[0][1] in index:
            
            flag = 1
if date[0][0] in index and date[2][0] in index:
    if date[1][0] in index:
            flag = 1

if date[0][0] in index and date[2][2] in index:
    if date[1][1] in index:

            flag = 1
if date[2][0] in index and date[2][2] in index:
    if date[1][1] in index:

        flag = 1
if date[0][2] in index and date[2][2] in index:
    if date[1][1] in index:

        flag = 1
if date[0][1] in index and date[2][1] in index:
    if date[1][1] in index:

        flag = 1
if date[1][0] in index and date[1][2] in index:
    if date[1][1] in index:

        flag = 1


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

Submission status: Wrong Answer

Solution code:
date = []
dict = {}
for i in range(3):
    temp = [int(j) for j in input().split()]
    date.append(temp)
N = int(input())

for i in  range(N):
    m = int(input())
    for j in date:
        if m in j:
            dict[m] = 1
index = list(dict.keys())


if date[0][0] in index and date[0][2] in index:
    if date[0][1] in index:
            print("Yes")
elif date[0][0] in index and date[2][0] in index:
    if date[1][0] in index:
            print("Yes")
elif date[0][0] in index and date[2][2] in index:
    if date[1][1] in index:
            print("Yes")
elif date[2][0] in index and date[2][2] in index:
    if date[2][1] in index:
            print("Yes")
elif date[0][2] in index and date[2][2] in index:
    if date[1][2] in index:
            print("Yes")
elif date[0][1] in index and date[2][1] in index:
    if date[1][1] in index:
            print("Yes")
elif date[1][0] in index and date[1][2] in index:
    if date[1][1] in index:
            print("Yes")


else:
    print("No")

Submission status: Wrong Answer

Solution code:
date = []
dict = {}
for i in range(3):
    temp = [int(j) for j in input().split()]
    date.append(temp)
N = int(input())

for i in  range(N):
    m = int(input())
    for j in date:
        if m in j:
            dict[m] = 1
index = list(dict.keys())
if len(index)>2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
date = []
dict = {}
for i in range(3):
    temp = [int(j) for j in input().split()]
    date.append(temp)
N = int(input())

for i in  range(N):
    m = int(input())
    for j in date:
        if m in j:
            dict[m] = 1
index = list(dict.keys())
index2 = [date[0][0],date[0][2],date[2][0],date[2][2]]
count = 0
index3 = []
for i in index:
    if i in index2:
        count += 1
        index3.append(i)
if count < 2:
    print("No")
else:
    if date[0][0] in index3 and date[0][2] in index3:
        if date[0][1] in index:
            print("Yes")
    elif date[0][0] in index3 and date[2][0] in index3:
        if date[1][0] in index:
            print("Yes")
    elif date[0][0] in index3 and date[2][2] in index3:
        if date[1][1] in index:
            print("Yes")
    elif date[2][0] in index3 and date[2][2] in index3:
        if date[2][1] in index:
            print("Yes")
    elif date[0][2] in index3 and date[2][2] in index3:
        if date[1][2] in index:
            print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
import numpy as np

a = np.array([list((int(_) for _ in input().split())) for x in range(3)])
n = int(input())
b = {int(input()) for _ in range(n)}

wk = "No"
for i in range(3):
    if (set(a[i][:]) <= b) | (set(a[:][i]) <= b):
        wk = "Yes"
if ({a[0][0], a[1][1], a[2][2]} <= b) | ({a[0][2], a[1][1], a[2][0]} <= b):
    wk = "Yes"
print(wk)

Submission status: Wrong Answer

Solution code:
import numpy as np

a = [list((int(_) for _ in input().split())) for x in range(3)]
n = int(input())
b = {int(input()) for _ in range(n)}

wk = "No"
for i in range(3):
    if (set(a[i][:]) <= b) | (set(a[:][i]) <= b):
        wk = "Yes"
if ({a[0][0], a[1][1], a[2][2]} <= b) | ({a[0][2], a[1][1], a[2][0]} <= b):
    wk = "Yes"
print(wk)

Submission status: Wrong Answer

Solution code:
x=list(map(int,input().split()))
y=list(map(int,input().split()))
z=list(map(int,input().split()))
A=[x,y,z]
X=[A[0][0],A[1][0],A[2][0]]
Y=[A[0][1],A[1][1],A[2][1]]
Z=[A[0][1],A[1][1],A[2][1]]
P=[A[0][0],A[1][1],A[2][2]]
Q=[A[2][2],A[1][1],A[0][0]]
B=[]
for i in range(int(input())):
    B.append(int(input()))
C=[x,y,z,X,Y,Z,P,Q]
for c in C:
    if set(c)<=set(B):
        print("Yes")
        break
else:
    print("No")

Submission status: Wrong Answer

Solution code:
#標準入力
a = []
for i in range(3):
    a2 = list(map(int,input().split()))
    a.append(a2)
n = int(input())
c = [0 for i in range(4)]
#実際の処理
for i in range(n):
    b = int(input())
    #縦の判定
    for j in range(3):
        for k in range(3):
            if a[j][k] == b:
                c[0] += 1
    #横の判定
    for j in range(3):
        for k in range(3):
            if a[k][j] == b:
                c[1] += 1
    #斜め二通りの判定
    for j in range(3):
        if a[j][j] == b:
            c[2] += 1

    for j in range(3):
        for k in range(0,3,-1):
            if a[j][k] == b:
                c[3] += 1
                
if str(3) in str(c):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

wk = "No"
for i in range(3):
    if (set(a[i][:]) <= b) | (set(a[:][i]) <= b):
        wk = "Yes"
if ({a[0][0], a[1][1], a[2][2]} <= b) | ({a[0][2], a[1][1], a[2][0]} <= b):
    wk = "Yes"
print(wk)

Submission status: Wrong Answer

Solution code:
first_array = [int(i) for i in input().split()]
second_array = [int(i) for i in input().split()]
third_array = [int(i) for i in input().split()]
N = int(input())
bs = []
for i in range(N):
  bs.append(i)
first_array = [(i in bs) for i in first_array]
second_array = [(i in bs) for i in second_array]
third_array = [(i in bs) for i in third_array]
check_array = [True for i in range(3)]
bingo = [first_array, second_array, third_array]

def main():
  bingo_count = int()
  for horizon in bingo:
    bingo_count += int(horizon == check_array)
  for i in range(3):
    vertical = []
    for j in range(3):
      vertical.append(bingo[j][i])
    bingo_count += int(vertical == check_array)
  diagnal = [bingo[i][up] for up,i in enumerate(reversed(range(3)))]
  bingo_count += int(diagnal == check_array)
  diagnal = [bingo[i][i] for i in range(3)]
  bingo_count += int(diagnal == check_array)
  if bingo_count > 0:
    print("Yes")
  else:
    print("No")
main()

Submission status: Wrong Answer

Solution code:

a = list(list(map(int,input().split())) for _ in range(3))

N = int(input())

b = list(int(input()) for _ in range(N))


ax = [[0]*3]*3

for k in range(N):
    for i in range(3):
        for j in range(3):
            if a[i][j] == b[k]:ax[i][j]= 1


for i in range(3):
    xcnt = 0
    ycnt = 0
    for j in range(3):
        if ax[i][j] == 1:xcnt +=1
        if ax[j][i] == 1:ycnt +=1

mid = 0
for i in range(3):
    if ax[i][1] == 1:mid +=1


xxcnt = 0
yxcnt = 0
xycnt = 0
for i in range(3):
    if ax[i][i] == 1:xxcnt+=1

for i in range(3):
    if ax[2-i][i] == 1:xycnt+=1


if xcnt == 3 or ycnt == 3 or xxcnt == 3 or xycnt == 3 or yxcnt == 3 or mid == 3:
    print("Yes")

else:
    print("No")

Submission status: Wrong Answer

Solution code:

a = list(list(map(int,input().split())) for _ in range(3))

N = int(input())

b = list(int(input()) for _ in range(N))


ax = [[0]*3]*3

for k in range(N):
    for i in range(3):
        for j in range(3):
            if a[i][j] == b[k]:ax[i][j]= 1


for i in range(3):
    xcnt = 0
    ycnt = 0
    for j in range(3):
        if ax[i][j] == 1:xcnt +=1
        if ax[j][i] == 1:ycnt +=1


xxcnt = 0
yxcnt = 0
xycnt = 0
for i in range(3):
    if ax[i][i] == 1:xxcnt+=1

for i in range(3):
    if ax[2-i][i] == 1:xycnt+=1

for i in range(3):
    if ax[i][2-i] == 1:yxcnt+=1

if xcnt == 3 or ycnt == 3 or xxcnt == 3 or xycnt == 3 or yxcnt == 3:
    print("Yes")

else:
    print("No")

Submission status: Wrong Answer

Solution code:

a = list(list(map(int,input().split())) for _ in range(3))

N = int(input())

b = list(int(input()) for _ in range(N))


ax = [[0]*3]*3

for k in range(N):
    for i in range(3):
        for j in range(3):
            if a[i][j] == b[k]:ax[i][j]= 1


ans = 0
for i in range(3):
    xcnt = 0
    ycnt = 0
    for j in range(3):
        if ax[i][j] == 1:xcnt +=1
        if ax[j][i] == 1:ycnt +=1


xxcnt = 0
for i in range(3):
    if ax[i][i] == 1:xxcnt+=1


if xcnt == 3 or ycnt == 3 or xxcnt == 3:
    print("Yes")

else:
    print("No")

Submission status: Wrong Answer

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

wk = "No"
for i in range(3):
    if (set(a[i][:]) <= b) or (set(a[:][i]) <= b):
        wk = "Yes"
if ({a[0][0], a[1][1], a[2][2]} <= b) or ({a[0][2], a[1][1], a[2][0]} <= b):
    wk = "Yes"
print(wk)

Submission status: Wrong Answer

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

wk = "No"
for i in range(3):
    if (set(a[i][:]) <= b) or (set(a[:][i]) <= b):
        wk = "Yes"
    if ({a[0][0], a[1][1], a[2][2]} <= b) or ({a[0][2], a[1][1], a[2][0]} <= b):
        wk = "Yes"
print(wk)

Submission status: Wrong Answer

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

wk = "No"
for i in range(3):
    if (set(a[i][:]) < b) or (set(a[:][i]) < b):
        wk = "Yes"
    if ({a[0][0], a[1][1], a[2][2]} < b) or ({a[0][2], a[1][1], a[2][0]} < b):
        wk = "Yes"
print(wk)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    m = [input() for _ in range(3)]
    n = input()
    a = [int(input()) for _ in range(int(n))]
    c =[]
    for i in m:
        b = [int(j) for j in i.split()]
        c.append(b)

    for n,i in enumerate(c):
        for m,j in enumerate(i):
            if j in a:
                print("A")
                c[n][m] = -1
                
    re = []
    for i in range(3):
        tmp = []
        tmp2 = []
        for j in range(3):
            tmp.append([i,j])
            tmp2.append([j,i])
        re.append(tmp)
        re.append(tmp2)
    re.append([[0,2],[1,1],[2,0]])
    re.append([[0,0],[1,1],[2,2]])

    f = 0
    for i in re:
        flg =[]
        for n,j in enumerate(i):
            if c[j[0]][j[1]] == -1:
                flg.append(1)
            else:
                flg.append(0)
        if flg == [1,1,1]:
            f = 1
    
    if f == 1:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
A = []
bingo = 0
for i in range(3):
    a = list(map(int, input().split()))
    A.append(a)

n = int(input())

for i in range(n):
    b = int(input())
    for ai in A:
        if b in ai:
            ai[ai.index(b)] = None

for i in range(3):
    if A[i] == [None, None, None]:
        bingo = 1

    if [A[i][0], A[i][1], A[i][2]] == [None, None, None]:
        bingo = 1

if [A[0][0], A[1][1], A[2][2]] == [None, None, None] or [A[0][2], A[1][1], A[2][0]] == [None, None, None]:
    bingo = 1

print("Yes") if bingo == 1 else print("No")

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
A = []
bingo = 0
for i in range(3):
    a = list(map(int, input().split()))
    A.append(a)

n = int(input())

for i in range(n):
    b = int(input())
    for ai in A:
        if b in ai:
            ai[ai.index(b)] = None

for i in range(3):
    if A[i] == [None, None, None]:
        bingo = 1
    for j in range(3):
        if [A[i][j], A[i][j], A[i][j]] == [None, None, None]:
            bingo = 1

if [A[0][0], A[1][1], A[2][2]] == [None, None, None] or [A[0][2], A[1][1], A[2][0]] == [None, None, None]:
    bingo = 1

print("Yes") if bingo==1 else print("No")

Submission status: Wrong Answer

Solution code:
import sys

A = []

flag_First = True
for Count in range(3):
    for x in input().split(' '):
        x.strip('\n')
        InputValue = int(x)
        if 1<=int(x)<=100:
            if flag_First==True:
                A.append (InputValue)
                flag_First = False
            else:
                for Index in A:
                    if Index == InputValue:
                        print('No')
                        sys.exit()

                A.append (InputValue)
        else:
            print('No')
            sys.exit()

N = int(input())
if N<=0 and N>10:
    print('No')
    sys.exit()

B = []
for Count in range(1,N+1):
    InputValue = int(input())
    if 1<=InputValue<=100:
        if Count == 1:
            B.append (InputValue)
        else:
            for Index in B:
                if Index == InputValue:
                    print('No')
                    sys.exit()

            B.append (InputValue)

Bingo =[0,0,0,0,0,0,0,0,0]

for Item_B in B:
    for Index,Item_A in enumerate(A):
        if Item_A == Item_B:
            Bingo[Index]= 1

def CheckHorizontalBingo(Start,End):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Start<=Index<=End:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print('Yes')
        sys.exit()

CheckHorizontalBingo(0,2)
CheckHorizontalBingo(3,5)
CheckHorizontalBingo(6,8)

def CheckVerticalBingo(One,Two,There):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Index==One or Index==Two or Index==There:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print('Yes')
        sys.exit()

CheckVerticalBingo(0,3,6)
CheckVerticalBingo(1,4,7)
CheckVerticalBingo(2,5,8)

def CheckDiagonalBingo(One,Two,There):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Index==One or Index==Two or Index==There:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print('Yes')
        sys.exit()

CheckDiagonalBingo(0,4,8)
CheckDiagonalBingo(3,5,7)

print('No')

Submission status: Wrong Answer

Solution code:
import sys

A = []

flag_First = True
for Count in range(3):
    for x in input().split(' '):
        x.strip('\n')
        InputValue = int(x)
        if 1<=int(x)<=100:
            if flag_First==True:
                A.append (InputValue)
                flag_First = False
            else:
                for Index in A:
                    if Index == InputValue:
                        sys.exit()

                A.append (InputValue)
        else:
            sys.exit()

N = int(input())
if N<=0 and N>10:
    sys.exit()

B = []
for Count in range(1,N+1):
    InputValue = int(input())
    if 1<=InputValue<=100:
        if Count == 1:
            B.append (InputValue)
        else:
            for Index in B:
                if Index == InputValue:
                    sys.exit()

            B.append (InputValue)

Bingo =[0,0,0,0,0,0,0,0,0]

for Item_B in B:
    for Index,Item_A in enumerate(A):
        if Item_A == Item_B:
            Bingo[Index]= 1

def CheckHorizontalBingo(Start,End):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Start<=Index<=End:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print('Yes')
        sys.exit()

CheckHorizontalBingo(0,2)
CheckHorizontalBingo(3,5)
CheckHorizontalBingo(6,8)

def CheckVerticalBingo(One,Two,There):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Index==One or Index==Two or Index==There:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print('Yes')
        sys.exit()

CheckVerticalBingo(0,3,6)
CheckVerticalBingo(1,4,7)
CheckVerticalBingo(2,5,8)

def CheckDiagonalBingo(One,Two,There):

    Flag_Bingo = True
    for Index,Item in enumerate(Bingo):
        if Index==One or Index==Two or Index==There:
            if Item == 0 :
                Flag_Bingo = False

    if Flag_Bingo == True:
        print('Yes')
        sys.exit()

CheckDiagonalBingo(0,4,8)
CheckDiagonalBingo(3,5,7)

print('No')