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:


A1 = list(input().split())
A2 = list(input().split())
A3 = list(input().split())
n = int(input())

B = []
for _ in range(n):
    B.append(input())

for i in B:
    if i in A1:
        A1[A1.index(i)] = "#"
    elif i in A2:
        A2[A2.index(i)] = "#"
    elif i in A3:
        A3[A3.index(i)] = "#"

flag = 0
for i in range(3):
    if A1[i] == "#":
        flag += 1
    if A2[i] == "#":
        flag += 1
    if A3[i] == "#":
        flag += 1
    if flag != 3:
        flag = 0
if flag == 3:
    print("Yes")
    exit()

if A1[0] == "#" and A1[1] == "#" and A1[2] == "#":
    print("Yes")
    exit()

if A2[0] == "#" and A2[1] == "#" and A2[2] == "#":
    print("Yes")
    exit()

if A3[0] == "#" and A3[1] == "#" and A3[2] == "#":
    print("Yes")
    exit()

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

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

print("No")

Submission status: Wrong Answer

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

chk = 0
colc = [0, 0, 0]
naname = 0
inaname = 0
for r_idx, row in enumerate(table):
    rcnt = 0
    for c_idx, col in enumerate(row):
        if col in p_list:
            rcnt += 1
            colc[c_idx] += 1
            if r_idx == c_idx:
                naname += 1
                if r_idx == 1 and c_idx == 1:
                    inaname += 1
            if abs(r_idx - c_idx) == 2:
                inaname += 1
    if rcnt == 3:
        chk += 1

if len(list(filter(lambda x: x > 0, colc))) > 0:
    chk += 1

if naname == 3:
    chk += 1
if inaname == 3:
    chk += 1

print('YES' if chk > 0 else '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()))
a = []
a.append(a1)
a.append(a2)
a.append(a3)
n = int(input())
b = list(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] = "o"
if (len(set(a[0])) == 1 and a[0] =="o") or (len(set(a[1])) == 1 and a[1] =="o") or (len(set(a[2])) == 1 and a[2] =="o") or (a[0][0] == a[1][0] and a[1][0] ==a[2][0] and a[2][0] =="o") or (a[0][1] == a[1][1] and a[1][1] ==a[2][1] and a[2][1] =="o") or (a[0][2] == a[1][2] and a[1][2] ==a[2][2] and a[2][2] =="o") or (a[0][0] == a[1][1] and a[1][1] == a[2][2] and a[2][2] == "o") or (a[0][2] == a[1][1] and a[1][1] == a[2][0] and a[2][0] == "o"):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# 横チェック
def yoko(bingo):
    i,j = 0,0
    isbingo = False
    for i in [0,1,2]:
        for j in [0,1,2]:
            if bingo[i][j] in b:
                if j==2:
                    return True
            else:
                break
    return False

def tate(bingo):
    i,j = 0,0
    isbingo = False
    for j in [0,1,2]:
        for i in [0,1,2]:
            if bingo[i][j] in b:
                if i==2:
                    return True
            else:
                break
    return False

def naname(bingo):
    i,j = 0,0
    isbingo = False
    for i,j in zip([0,1,2],[0,1,2]):
        if bingo[i][j] in b:
            if i==2:
                return True
            else:
                break
    for i,j in zip([2,1,0],[2,1,0]):
        if bingo[i][j] in b:
            if i==2:
                return True
            else:
                break
    return False

row1 = list(map(int, input().split()))
row2 = list(map(int, input().split()))
row3 = list(map(int, input().split()))
n = int(input())
i = 0
b = []
while(i < n):
  b.append(int(input()))
  i += 1

bingo = []
bingo.append(row1)
bingo.append(row2)
bingo.append(row3)
if tate(bingo)|yoko(bingo)|naname(bingo):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

B=[A1[0], A2[1], A3[2]]
C=[A1[2], A1[1], A3[0]]
D=[A1[0], A2[0], A3[0]]
E=[A1[1], A2[1], A3[1]]
F=[A1[2], A2[2], A3[2]]
if len(set(A1) & set(b))>2 or len(set(A2) & set(b))>2 or len(set(A3) & set(b))>2  or len(set(B) & set(b))>2 or len(set(C) & set(b))>2  or len(set(D) & set(b))>2 or len(set(E) & set(b))>2 or len(set(F) & set(b))>2:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

A_list=[[int(j) for j in input().split()] for i in range(3)]
N = int(input().strip())
b_list=[int(input().strip()) for _ in range(N)]
#-----

for num in b_list:
    for ai in range(3):
        for aj in range(3):
            if num == A_list[ai][aj]:
                A_list[ai][aj] = "O"

Flag=False
for i in range(3):
    if A_list[i][0]==A_list[i][1]==A_list[i][2]=="O":
        Flag = True

if A_list[0][0]==A_list[1][1]==A_list[2][2]=="O":
    Flag = True
if A_list[2][0]==A_list[1][1]==A_list[0][2]=="O":
    Flag = True

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

Submission status: Wrong Answer

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

n = int(input())
b = [int(input()) for i in range(n)]
c = []
for ii in range(n):
    for iii in range(9):
        if b[ii] == l[iii]:
            c.append(iii)
            break
flag = 'No'
for j in range(3):
    if 3*i and 3*i+1 and 3*i+2 in c:
        flag = 'Yes'
        break
    if i and 3+i and 6+i in c:
        flag = 'Yes'
        break
if 0 and 4 and 8 in c:
    flag = 'Yes'
elif 2 and 4 and 6 in c:
    flag = 'Yes'

print(flag)

Submission status: Wrong Answer

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

b = []
for i in range(n):
    b_ = int(input())
    b.append(b_)
# print(a)
# print(b)
for i in range(3):
    for k in range(3):
        for j in range(n):
                if a[i][k] == b[j]:
                    a[i][k] = 'ok'

conc = []

for i in range(3):
    for j in range(3):
        s = [i,j]
        if a[i][j] == 'ok':
            conc.append(s)

# print(a)
# print(conc)
x = []
y = []

if conc == []:
    print('No')
else:
    for i in range(3):
        x.append(conc[i][0])
        y.append(conc[i][1])
    if (len(set(x)) or len(set(y))) or (len(set(x)) and len(set(y))) == 3:
        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 _ in range(n)]

if a[0][0] in b and a[0][1] in b and a[0][2] in b:
    print('Yes')
    exit()
if a[1][0] in b and a[1][1] in b and a[2][1] in b:
    print('Yes')
    exit()
if a[2][0] in b and a[1][2] in b and a[2][2] in b:
    print('Yes')
    exit()
if a[0][0] in b and a[1][0] in b and a[2][0] in b:
    print('Yes')
    exit()
if a[0][1] in b and a[1][1] in b and a[2][1] in b:
    print('Yes')
    exit()
if a[0][2] in b and a[1][2] in b and a[2][2] in b:
    print('Yes')
    exit()
if a[0][0] in b and a[1][1] in b and a[2][2] in b:
    print('Yes')
    exit()
if a[0][2] in b and a[1][1] in b and a[2][0] in b:
    print('Yes')
    exit()
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()))
A = list()
A.extend(A1)
A.extend(A2)
A.extend(A3)
N = int(input())
B = list()
result = list()
for _ in range(N):
    B.append(int(input()))
for e in B:
    if e in A:
        result.append(A.index(e))

loopflag = False
if N >= 3:
    for i in range(0, len(result)):
        for j in range(0, len(result)):
            for k in range(0, len(result)):
                if (i==j or j==k or k==i):
                    break
                if((result[i] + result[j] + result[k]) % 3 == 0):
                    loopflag = True
    if loopflag:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s = list(map(int, input().split()))
t = list(map(int, input().split()))
u = list(map(int, input().split()))

bingo = [s, t, u]

n = int(input())
numbers = [int(input()) for _ in range(n)]

for i in range(3):
    for j in range(3):
        if bingo[i][j] in numbers:
            bingo[i][j] = 0

for i in range(3):
    if not all(bingo[i]):
        print('Yes')
        exit()

if (bingo[0][0] == 0 and bingo[1][1] == 0 and bingo [2][2] == 0) or (bingo[0][2] == 0 and bingo[1][1] == 0 and bingo [2][0] == 0):
    print('Yes')
    exit()

t_bingo = list(zip(*bingo))

for i in range(3):
    if not all(t_bingo[i]):
        print('Yes')
        exit()

print('No')

Submission status: Wrong Answer

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

    n = int(input())

    b = [None]*n
    for i in range(n):
        b[i] = int(input())

    check = [[False]*3]*3

    for i in range(3):
        for j in range(3):
            if a[i][j] in b:
                check[i][j] = True

    for i in range(3):
        if check[i] == [True]*3:
            print("Yes")
            return
        if [row[i] for row in a] == [True]*3:
            print("Yes")
            return

    if [check[0][0],check[1][1],check[2][2]] == [True]*3:
        print("Yes")
        return
    if [check[0][2],check[1][1],check[2][0]] == [True]*3:
        print("Yes")
        return
    print("No")
main()

Submission status: Wrong Answer

Solution code:
a=[]
i=input('')
i=i.split(' ')
a.append(i)
i=input('')
i=i.split(' ')
a.append(i)
i=input('')
i=i.split(' ')
a.append(i)
for p in range(3):
    for q in range(3):
        a[p][q]=int(a[p][q])

n=int(input(''))
b=[]
for p in range(n):
    q=int(input())
    b.append(q)

i=int(0)
hit=[]
kara=[0,0,0]
for i in range(3):
    hit.append(kara)

def bingo():
    global hit
    h=0
    if h==0:
        for i in range(3):
            if hit[i][0]*hit[i][1]*hit[i][2]==1:
                h=1
    
    if h==0:
        for i in range(3):
            if hit[0][i]*hit[1][i]*hit[2][i]==1:
                h=1

    if h==0:
        if hit[0][0]*hit[1][1]*hit[2][2]==1:
            h=1
    
    if h==0:
        if hit[2][0]*hit[1][1]*hit[0][2]==1:
            h=1

    return h


for t in b:
    for i in range(3):
        for j in range(3):
            if a[i][j]==t:
                hit[i][j]=1

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

Submission status: Wrong Answer

Solution code:
a=[list(map(int,input().split())) for _ in range(3)]
b=[int(input()) for _ in range(int(input()))]
for i in range(3):
    for j in range(3):
        if a[i][j] in b:
            a[i][j]=0
ans="No"            
for i in range(3):
    if a[i][0]==a[i][1]==a[i][2]==0:
        ans="Yes"
for i in range(3):
    if a[0][i]==a[1][i]==a[2][i]==0:
        ans="Yes"
if a[0][0]==a[1][1]==a[2][2]==0:
    ans="Yes"
if a[0][2]==a[1][1]==a[2][0]==0:
    ans="Yes"
print(ans)    
for i in a:
    print(i)

Submission status: Wrong Answer

Solution code:
li1 = list(map(int,input().split()))
li2 = list(map(int,input().split()))
li3 = list(map(int,input().split()))
N = int(input())
b = [int(input()) for i in range(N)]
A = li1+li2+li3

hit = []
for i in b:
    if i in A:
        hit.append(A.index(i)+1)

if (1 in hit and 2 in hit and 3 in hit)\
or (4 in hit and 5 in hit and 6 in hit)\
or (7 in hit and 8 in hit and 9 in hit)\
or (1 in hit and 4 in hit and 7 in hit)\
or (2 in hit and 5 in hit and 8 in hit)\
or (3 in hit and 6 in hit and 9 in hit)\
or (1 in hit and 5 in hit and 9 in hit)\
or (3 in hit and 5 in hit and 7 in hit):
    print("Tes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
#coding:utf-8
a =[list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]
#print(b)
check = [[0, 0, 0] for _ in range(3)]
#print(check)


for i in range(n):
    for j in range(0, 3):
        for k in range(0, 3):
            if int(b[i]) == int(a[j][k]):
                check[j][k] = 1

#print(check)

#print(sum(check[0]))

if sum(check[0]) == 3 or sum(check[1]) == 3 or sum(check[2]) == 3:
    print('Yes')
    exit()
elif check[0][0]+check[1][0]+check[2][0] == 3 or check[0][1]+check[1][1]+check[2][1]== 3 or check[0][2]+check[1][2]+check[2][2] == 3:
     print('Yes')
     exit()
elif check[0][0]+check[1][1]+check[2][2] == 3 or check[0][2]+check[1][1]+check[2][0]:
    print('Yes')
    exit()

print('No')

Submission status: Wrong Answer

Solution code:
X = []
Y = []
Z = []
for i in range(3):
    x, y, z = map(str, input().split())
    X.append(x)
    Y.append(y)
    Z.append(z)
N = int(input())

b = map(str, [input() for i in range(N)])

for x in sorted(b, reverse=True):
    X = [s.replace(x, 'OK') for s in X]
    Y = [s.replace(x, 'OK') for s in Y]
    Z = [s.replace(x, 'OK') for s in Z]

if ('OK' in X[0] and 'OK' in X[1] and 'OK' in X[2]
    or 'OK' in Y[0] and 'OK' in Y[1] and 'OK' in Y[2]
    or 'OK' in Z[0] and 'OK' in Z[1] and 'OK' in Z[2]
    or 'OK' in X[0] and 'OK' in Y[0] and 'OK' in Z[0]
    or 'OK' in X[1] and 'OKA, B = map(int, input().split())' in Y[1] and 'OK' in Z[1]
    or 'OK' in X[2] and 'OK' in Y[2] and 'OK' in Z[2]
    or 'OK' in X[0] and 'OK' in Y[1] and 'OK' in Z[2]
    or 'OK' in X[2] and 'OK' in Y[1] and 'OK' in Z[0]):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np
Flg = "No"
A = [[0]*3 for i in range(3)]
for i in range(3):
    A[i][0], A[i][1], A[i][2] = map(int, input().split())    
N = int(input())
b = [0]*N
for j in range(N):
    b[j] = int(input())

for i in range(3):
    for j in range(3):
        for k in range(N):
            if(A[i][j] == b[k]):
                A[i][j] = "*"
A_T = np.array(A).T
                
for i in range(3):
    if(A[i][0] == A[i][1] == A[i][2] == "*"):
        Flg = "Yes"        
        break
    if(A_T[i][0] == A_T[i][1] == A_T[i][2] == "*"):
        Flg = "Yes"
        break

if(A[0][0] == A[1][1] == A[2][2] == "*"):
    Flg = "Yes"

print(Flg)

Submission status: Wrong Answer

Solution code:
a1 = [int(x) for x in input().split()]
a2 = [int(x) for x in input().split()]
a3 = [int(x) for x in input().split()]
n = int(input())
b = []
for _ in range(n):
    b.append(input())
res = ""
for x in b:
    if int(x) == int(a1[0]):
        res += "1"
    if int(x) == int(a2[1]):
        res += "1"
    if int(x) == int(a3[2]):
        res += "1"
if res == "111":
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a,b,c=input().split()
d,e,f=input().split()
g,h,i=input().split()
N=int(input())
numbers=[input() for i in range(N)]

number=list(map(int,numbers))
A=int(a)
B=int(b)
C=int(c)
D=int(d)
E=int(e)
F=int(f)
G=int(g)
H=int(h)
I=int(i)

for n in number:
    if A==n:
        A=0
    elif B==n:
        B=0
    elif C==n:
        C=0
    elif D==n:
        D=0
    elif E==n:
        E=0
    elif F==0:
        F=0
    elif G== n:
        G = 0
    elif H == n:
        H = 0
    elif I == n:
        I = 0
    else:
        continue

if A==B==C or D==E==F or G==H==I or A==D==G or B==E==H or C==F==I or A==E==I or C==E==G:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np
f = np.zeros((3, 3))
b = np.zeros((3, 3))
f[0]=list(map(int,input().split()))
f[1]=list(map(int,input().split()))
f[2]=list(map(int,input().split()))
n= int(input())
for i in range(n):
  c = int(input())
  b=np.where(f == c, b + 1, b)
b=np.where(b > 0, 1, 0)
#print(b)
if all(b[0][:])|all(b[1][:])|all(b[2][:])\
|all(b[:][0])|all(b[:][1])|all(b[:][2])\
|all((b[0][0],b[1][1],b[2][2]))|all((b[0][2],b[1][1],b[2][0])):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import numpy as np

A_list = []

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

N = int(input())
narray = np.zeros((3, 3), dtype=np.int)


for j in range(N):
    b = int(input())

    for n in range(3):
        for m in range(3): 
            if A_list[n][m] == b:
                narray[n, m] = 1


n_list = np.count_nonzero(narray == 1, axis = 0)
m_list = np.count_nonzero(narray == 1, axis = 1)

if np.any(n_list == 3) or np.any(n_list == 3):
    print('Yes')
    exit()

if narray[0, 0] == 1 and narray[1, 1] == 1 and narray[2, 2] == 1:
    print('Yes')
    exit()

if narray[0, 2] == 1 and narray[1, 1] == 1 and narray[2, 0] == 1:
    print('Yes')
    exit()

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()))
A = list()
A.extend(A1)
A.extend(A2)
A.extend(A3)
N = int(input())
B = list()
result = list()
for _ in range(N):
    B.append(int(input()))
for e in B:
    if e in A:
        result.append(A.index(e))

loopflag = False
if N >= 3:
    for i in range(0, len(result)):
        for j in range(0, len(result)):
            for k in range(0, len(result)):
                if (i!=j and j!=k and k!=i):
                    break
                if((result[i] + result[j] + result[k]) % 3 == 0):
                    loopflag = True
    if loopflag:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
[A11,A12,A13] = list(map(int,input().split()))
[A21,A22,A23] = list(map(int,input().split()))
[A31,A32,A33] = list(map(int,input().split()))
N = int(input())

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

A=[A11,A12,A13,A21,A22,A23,A31,A32,A33]

#フラグ
sheet=[0]*9

for i in range(N):
    for j in range(9):
        if b[i]==A[j]:
            sheet[j]=1

if sheet[0]==1 and sheet[1]==1 and sheet[2]==1:
    print("Yes")
elif sheet[3]==1 and sheet[4]==1 and sheet[5]==1:
    print("Yes")
elif sheet[6]==1 and sheet[7]==1 and sheet[8]==1:
    print("Yes")
elif sheet[0]==1 and sheet[3]==1 and sheet[6]==1:
    print("Yes")
elif sheet[1]==1 and sheet[4]==1 and sheet[7]==1:
    print("Yes")
elif sheet[2]==1 and sheet[5]==1 and sheet[6]==1:
    print("Yes")
elif sheet[0]==1 and sheet[4]==1 and sheet[8]==1:
    print("Yes")
elif sheet[2]==1 and sheet[4]==1 and sheet[6]==1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
Alist=list(map(int,input().split()))
Blist=list(map(int,input().split()))
Clist=list(map(int,input().split()))
#print(Alist)
#print(Blist)
#print(Clist)
N=int(input())
mylist=[]
flaglist=[0,0,0,0,0,0,0,0] #8個のフラッグリスト
for i in range(N):
    mylist.append(int(input()))
    #print(mylist)
    
for i in range(3):
    for j in range(N):
        if Alist[i]==mylist[j]:
            flaglist[0]+=1
            
for i in range(3):
    for j in range(N):
        if Blist[i]==mylist[j]:
            flaglist[1]+=1
            
            
for i in range(3):
    for j in range(N):
        if Clist[i]==mylist[j]:
            flaglist[2]+=1
#ここまで横の列

for i in range(N):
    if Alist[0]==mylist[i]:
        flaglist[3]+=1
    elif Blist[0]==mylist[i]:
        flaglist[3]+=1
    elif Clist[0]==mylist[i]:
        flaglist[3]+=1
        
for i in range(N):
    if Alist[1]==mylist[i]:
        flaglist[4]+=1
    elif Blist[1]==mylist[i]:
        flaglist[4]+=1
    elif Clist[1]==mylist[i]:
        flaglist[4]+=1

for i in range(N):
    if Alist[2]==mylist[i]:
        flaglist[5]+=1
    elif Blist[2]==mylist[i]:
        flaglist[5]+=1
    elif Clist[2]==mylist[i]:
        flaglist[5]+=1
        
for i in range(N):
    if Alist[2]==mylist[i]:
        flaglist[6]+=1
    elif Blist[1]==mylist[i]:
        flaglist[6]+=1
    elif Clist[0]==mylist[i]:
        flaglist[6]+=1
        
for i in range(N):
    if Alist[0]==mylist[i]:
        flaglist[7]+=1
    elif Blist[1]==mylist[i]:
        flaglist[7]+=1
    elif Clist[2]==mylist[i]:
        flaglist[7]+=1
        
if max(flaglist)>3:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import numpy as np

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

for _ in range(n):
    num = int(input())
    if num in card:
        pos = tuple(nd[0] for nd in np.where(card == num))
        print(pos)
        card[pos[0], pos[1]] = 0

f = 0

for i in range(3):
    if sum(card[i,:]) == 0 or sum(card[:,i]) == 0:
        f = 1
    if card[0,0]+card[1,1]+card[2,2] == 0 or card[2,0]+card[1,1]+card[2,0] == 0:
        f = 1

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

Submission status: Wrong Answer

Solution code:
import numpy as np
def resolve_b():
    card = [list(map(int, input().split())) for i in range(3)]
    l = [[0,0,0],[0,0,0],[0,0,0]]
    n = int(input())

    for i in range(n):
        num = int(input())
        for j in range(3):
            for k in range(3):
                if card[j][k] == num:
                    l[j][k] = 1
    nl = np.array(l)

    if sum(l[0]) == 3 or sum(l[1]) == 3 or sum(l[2]) == 3 or sum(l[:][0]) == 3 or sum(nl[:,0]) ==3 or sum(nl[:,1]) ==3 or sum(nl[:,2])==3:
        print("Yes")
    elif (l[0][0] + l[1][1] + l[2][2]) == 3 or (l[0][2] + l[1][1] + l[2][0]):
        print("Yes")
    else:
        print("No")
resolve_b()

Submission status: Wrong Answer

Solution code:
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(3):
    A.append([A[0][i] ,A[1][i] ,A[2][i]])
A.append([A[0][0] ,A[1][1] ,A[2][2]])
A.append([A[0][2] ,A[1][1] ,A[2][0]])

cnt1 = 0
for i in range(7):
    cnt = 0
    for j in range(3):
        for k in range(N):
            if A[i][j] == B[k]:
                cnt += 1
            if cnt == 3:
                cnt1 = 100
if cnt1 != 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
def checkbingo(bingo,bs):
  for b in bingo:
    cnt = 0
    for n in bs:
      if n in b:
        cnt +=1
    if cnt == 3:
      return True
  return False

list1 = input('').split(' ')
list2 = input('').split(' ')
list3 = input('').split(' ')
bingo = [list1,list2,list3]
for i in range(0,2):
  bingo.append([list1[i],list2[i],list3[i]])
bingo.append([list1[0],list1[1],list2[2]])
bingo.append([list1[2],list1[1],list2[0]])
max_n = int(input(''))
bs = []
result = False
for n in range(0,max_n):
  b = input('')
  bs.append(b)
if checkbingo(bingo,bs):
  result = True

if result == True:
    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())
  if(a1[0]==b):
    a1[0]=0
  if(a1[1]==b):
    a1[1]=0
  if(a1[2]==b):
    a1[2]=0
  if(a2[0]==b):
    a2[0]=0
  if(a2[1]==b):
    a2[1]=0
  if(a2[2]==b):
    a2[2]=0
  if(a3[0]==b):
    a3[0]=0
  if(a3[1]==b):
    a3[1]=0
  if(a3[2]==b):
    a3[2]=0                                   
l1=[a1[0],a2[0],a3[0]]
l2=[a1[1],a2[1],a3[1]]
l3=[a1[2],a2[2],a3[2]]
l4=[a1[0],a1[1],a1[2]]
l5=[a2[0],a2[1],a2[2]]
l6=[a3[0],a3[1],a3[2]]
l7=[a1[0],a2[1],a3[2]]
l8=[a1[2],a2[1],a3[0]]
if(sum(l1)==0 or sum(l2)==0 or sum(l3)==0 or sum(l4)==0 or sum(l5)==0 or sum(l6)==0 or sum(l7)==0 or sum(l1)==8):
  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()))
N = int(input())
D = [int(input()) for j in range(N)]
a = D.count(A[0])
b = D.count(A[1])
c = D.count(A[2])
d = D.count(B[0])
e = D.count(B[1])
f = D.count(B[2])
g = D.count(C[0])
h = D.count(C[1])
i = D.count(C[2])
Sum1 = (a + b + c +1) % 4
Sum2 = (d + e + f + 1) % 4
Sum3 = (g + h + i +1) % 4
Sum4 = (a + e + i +1) % 4
Sum5 = (c + e + g +1) % 4
list = [Sum1,Sum2,Sum3,Sum4,Sum5]
s = list.count(0)
if s >= 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

count = 0
while count < N:
    for i in range(0,3):
      for j in range(0,3):
        if b[count] == A[i][j]:
          A[i][j] = 0
    count += 1
            
sum_y = [0]*3                
for i in range(0,3):
  for j in range(0,3):
    sum_y[i] = A[i][j]#横

sum_t = [0]*3
for i in range(0,3):
  for j in range(0,3):
    sum_t[i] = A[j][i]
    

sum1 = A[0][0] + A[1][1] + A[2][2]
sum2 = A[0][2] + A[1][1] + A[0][2]


if sum_y[0] == 0:
    print("Yes")
elif sum_y[1] == 0:
    print("Yes")
elif sum_y[2] == 0:
    print("Yes")
elif sum_t[0] == 0:
    print("Yes") 
elif sum_t[1] == 0:
    print("Yes") 
elif sum_t[2] == 0:
    print("Yes") 
elif sum1 == 0:
  print("Yes")
elif sum2 == 0:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
A_list = []
for i in range(3):
    A = list(map(int, input().split()))
    A_list.append(A)
N = int(input())
for i in range(N):
    B = int(input())
    for j in range(3):
        for k in range(3):
            if A_list[j][k]==B:
                A_list[j][k] = -1
flag = True
for i in range(3):
    for j in range(3):
        if A_list[i][j]!=-1:
            flag = False
            break
if flag:
    print("Yes")
    exit()
else:
    flag = True
for i in range(3):
    for j in range(3):
        if A_list[j][i]!=-1:
            flag = False
            break
if flag:
    print("Yes")
    exit()
else:
    flag = True
for i in range(3):
    if A_list[i][i]!=-1:
        flag = False
        break
if flag:
    print("Yes")
    exit()
else:
    flag = True
for i in range(3):
    if A_list[i][2-i]!=-1:
        flag = False
        break
if flag:
    print("Yes")
    exit()
else:
    flag = True

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np


def main():
    A = np.array([list(map(int, input().split())) for _ in range(3)])
    N = int(input())
    B = np.array([int(input()) for _ in range(N)])

    result = np.zeros((3, 3))

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

    for i in range(3):
        if all(result[i, :]):
            print('Yes')
            exit(0)
        if all(result[:, i]):
            print('Yes')
            exit(0)
    if all([result[0, 0], result[1, 1], result[2, 2]]):
        print('Yes')
        exit(0)
    print('No')


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

c = [[-1,-1,-1],[-1,-1,-1],[-1,-1,-1]]

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

if c[0][0] == 1 & c[0][1] == 1 & c[0][2] == 1:
    ans = True
elif c[1][0] == 1 & c[1][1] == 1 & c[1][2] == 1:
    ans = True
elif c[2][0] == 1 & c[2][1] == 1 & c[2][2] == 1:
    ans = True
elif c[0][0] == 1 & c[1][0] == 1 & c[2][0] == 1:
    ans = True
elif c[0][1] == 1 & c[1][1] == 1 & c[2][1] == 1:
    ans = True
elif c[0][2] == 1 & c[1][2] == 1 & c[2][2] == 1:
    ans = True
elif c[0][0] == 1 & c[1][1] == 1 & c[2][2] == 1:
    ans = True
elif c[2][0] == 1 & c[1][1] == 1 & c[1][1] == 1:
    ans = True

if ans:
    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()))
a = []
a.append(a1)
a.append(a2)
a.append(a3)
n = int(input())
b = list(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] = "o"
if (len(set(a[0])) == 1 and a[0] =="o") or (len(set(a[1])) == 1 and a[1] =="o") or (len(set(a[2])) == 1 and a[2] =="o") or (a[0][0] == a[1][0] and a[1][0] ==a[2][0] and a[2][0] =="o") or (a[0][1] == a[1][1] and a[1][1] ==a[2][1] and a[2][1] =="o") or (a[0][2] == a[1][2] and a[1][2] ==a[2][2] and a[2][2] =="o") or (a[0][0] == a[1][1] and a[1][1] == a[2][2] and a[2][2] == "o"):
    print("Yes")
else:
    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 = []
for i in range(N):
  b.append(int(input()))

flag = 0
for i in range(N):
  for j in range(3):
    if b[i] == A1[j]:
      A1[j] = 0
    elif b[i] == A2[j]:
      A2[j] = 0
    elif b[i] == A3[j]:
      A3[j] = 0
if A2[1] == 0:
  if A2[0] == 0 and A2[2] == 0:
    flag = 1
  elif A1[1] == 0 and A3[1] == 0:
    flag = 1
  elif A1[0] == 0 and A3[2] == 0:
    flag = 1
  elif A1[2] == 0 and A2[0] == 0:
    flag = 1
elif A1[0] == 0 and A1[1] == 0 and A1[2] == 0:
  flag = 1
elif A1[0] == 0 and A2[0] == 0 and A3[0] == 0:
  flag = 1
elif A1[2] == 0 and A2[2] == 0 and A3[2] == 0:
  flag = 1
elif A3[0] == 0 and A3[1] == 0 and A3[2] == 0:
  flag = 1
if flag == 1:
  print('Yes')
else:
  print('No')