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:
Array = [list(map(int,input().split())) for _ in range(3)]
ArrayBingo = [[0,0,0],[0,0,0,],[0,0,0]]
N = int(input())
B = []
checkR = 0
checkG = 0
checkN = 0
for i in range (N):
    B.append(int(input()))
for l in range (N):
    for j in range (3):
        for k in range (3):
            if Array[j][k]==B[l]:
                ArrayBingo[j][k]=1
for i in range (3): 
    if (ArrayBingo[i][0] == 1):
        checkR+=1
if checkR ==3:
    print('Yes')
    checkR=4
    if checkR !=4:
        checkR=0
for i in range (3): 
    if (ArrayBingo[i][1] == 1):
        checkR+=1
if checkR ==3:
    print('Yes')
    checkR=4
if checkR!=4:    
    checkR=0
for i in range (3): 
    if (ArrayBingo[i][2] == 1):
        checkR+=1
if checkR ==3:
    print('Yes')
    checkR =4
else:
    checkR=0
for j in range (3):
    if (ArrayBingo[0][j] == 1):
        checkG+=1
if checkG ==3:
    print('Yes')
    checkG =4
if checkG !=4:
    checkG=0
for j in range (3):
    if (ArrayBingo[1][j] == 1):
        checkG+=1
if checkG ==3:
    print('Yes')
    checkG =4
if checkG !=4:
    checkG=0
for j in range (3):    
    if (ArrayBingo[2][j] == 1):
        checkG+=1
if checkG ==3:
    print('Yes')
    checkG =4
else:
    checkG=0
if (ArrayBingo[0][0] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][2] == 1) or (ArrayBingo[0][2] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][0] == 1):
    checkN = 1
else:
    checkN = 0
if checkR != 4 and checkG !=4 and checkN==1:
    print('Yes')
if checkR == 0 and checkG ==0 and checkN==0:
    print('No')

Submission status: Wrong Answer

Solution code:
Array = [list(map(int,input().split())) for _ in range(3)]
ArrayBingo = [[0,0,0],[0,0,0,],[0,0,0]]
N = int(input())
B = []
checkR = 0
checkG = 0
checkN = 0
for i in range (N):
    B.append(int(input()))
for l in range (N):
    for j in range (3):
        for k in range (3):
            if Array[j][k]==B[l]:
                ArrayBingo[j][k]=1
for i in range (3): 
    if (ArrayBingo[i][0] == 1):
        checkR+=1
if checkG ==3:
    print('Yes')
checkR=0
for i in range (3): 
    if (ArrayBingo[i][1] == 1):
        checkR+=1
if checkG ==3:
    print('Yes')
checkR=0
for i in range (3): 
    if (ArrayBingo[i][2] == 1):
        checkR+=1
if checkG ==3:
    print('Yes')
else:
    checkR=0
for j in range (3):
    if (ArrayBingo[0][j] == 1):
        checkG+=1
if checkG ==3:
    print('Yes')
checkG=0
for j in range (3):
    if (ArrayBingo[1][j] == 1):
        checkG+=1
if checkG ==3:
    print('Yes')
checkG=0
for j in range (3):    
    if (ArrayBingo[2][j] == 1):
        checkG+=1
if checkG ==3:
    print('Yes')
else:
    checkG=0
if (ArrayBingo[0][0] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][2] == 1) or (ArrayBingo[0][2] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][0] == 1):
    checkN = 1
else:
    checkN = 0
if checkN == 1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
Array = [list(map(int,input().split())) for _ in range(3)]
ArrayBingo = [[0,0,0],[0,0,0,],[0,0,0]]
N = int(input())
B = []
checkR = 0
checkG = 0
checkN = 0
for i in range (N):
    B.append(int(input()))
for l in range (N):
    for j in range (3):
        for k in range (3):
            if Array[j][k]==B[l]:
                ArrayBingo[j][k]=1
for i in range (3): 
    if (ArrayBingo[i][0] == 1):
        checkR+=1
checkR=0
for i in range (3): 
    if (ArrayBingo[i][1] == 1):
        checkR+=1
checkR=0
for i in range (3): 
    if (ArrayBingo[i][2] == 1):
        checkR+=1
    else:
        checkR=0
for j in range (3):
    if (ArrayBingo[0][j] == 1):
        checkG+=1
checkG=0
for j in range (3):
    if (ArrayBingo[1][j] == 1):
        checkG+=1
checkG=0
for j in range (3):    
    if (ArrayBingo[2][j] == 1):
        checkG+=1
    else:
        checkG=0
if (ArrayBingo[0][0] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][2] == 1) or (ArrayBingo[0][2] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][0] == 1):
    checkN = 1
else:
    checkN = 0
if checkR==3 or checkG == 3 or checkN == 1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
Array = [list(map(int,input().split())) for _ in range(3)]
ArrayBingo = [[0,0,0],[0,0,0,],[0,0,0]]
N = int(input())
B = []
checkR = 0
checkG = 0
checkN = 0
for i in range (N):
    B.append(int(input()))
for l in range (N):
    for j in range (3):
        for k in range (3):
            if Array[j][k]==B[l]:
                ArrayBingo[j][k]=1
for i in range (3): 
    if (ArrayBingo[i][0] == 1):
        checkR+=1
    elif (ArrayBingo[i][1] == 1):
        checkR+=1
    elif (ArrayBingo[i][2] == 1):
        checkR+=1
    else:
        checkR=0
for j in range (3):
    if (ArrayBingo[0][j] == 1):
        checkG+=1
    elif (ArrayBingo[1][j] == 1):
        checkG+=1
    elif (ArrayBingo[2][j] == 1):
        checkG+=1
    else:
        checkG=0
if (ArrayBingo[0][0] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][2] == 1) or (ArrayBingo[0][2] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][0] == 1):
    checkN = 1
else:
    checkN = 0
if checkR==3 or checkG == 3 or checkN == 1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
Array = [list(map(int,input().split())) for _ in range(3)]
ArrayBingo = [[0,0,0],[0,0,0,],[0,0,0]]
N = int(input())
B = []
checkR = 0
checkG = 0
checkN = 0
for i in range (N):
    B.append(int(input()))
for l in range (N):
    for j in range (3):
        for k in range (3):
            if Array[j][k]==B[l]:
                ArrayBingo[j][k]=1
for i in range (3): 
    if (ArrayBingo[i][0] == 1):
        checkR=1
    elif (ArrayBingo[i][1] == 1):
        checkR=1
    elif (ArrayBingo[i][2] == 1):
        checkR=1
    else:
        checkR=0
for j in range (3):
    if (ArrayBingo[0][j] == 1):
        checkG=1
    elif (ArrayBingo[1][j] == 1):
        checkG=1
    elif (ArrayBingo[2][j] == 1):
        checkG=1
    else:
        checkG=0
if (ArrayBingo[0][0] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][2] == 1) or (ArrayBingo[0][2] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][0] == 1):
    checkN = 1
else:
    checkN = 0
if checkR==1 or checkG == 1 or checkN == 1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
Array = [list(map(int,input().split())) for _ in range(3)]
ArrayBingo = [[0,0,0],[0,0,0,],[0,0,0]]
N = int(input())
B = []
checkR = 0
checkG = 0
checkN = 0
for i in range (N):
    B.append(int(input()))
for l in range (N):
    for j in range (3):
        for k in range (3):
            if Array[j][k]==B[l]:
                ArrayBingo[j][k]=1
for i in range (3): 
    if (ArrayBingo[i][0] == 1):
        checkR=1
    else:
        checkR=0
for i in range (3): 
    if (ArrayBingo[i][1] == 1):
        checkR=1
    else:
        checkR=0
for i in range (3): 
    if (ArrayBingo[i][2] == 1):
        checkR=1
    else:
        checkR=0
for j in range (3):
    if (ArrayBingo[0][j] == 1):
        checkG=1
    else:
        checkG=0
for j in range (3):
    if (ArrayBingo[1][j] == 1):
        checkG=1
    else:
        checkG=0
for j in range (3):
    if (ArrayBingo[2][j] == 1):
        checkG=1
    else:
        checkG=0
if (ArrayBingo[0][0] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][2] == 1) or (ArrayBingo[0][2] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][0] == 1):
    checkN = 1
else:
    checkN = 0
if checkR==1 or checkG == 1 or checkN == 1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
Array = [list(map(int,input().split())) for _ in range(3)]
ArrayBingo = [[0,0,0],[0,0,0,],[0,0,0]]
N = int(input())
B = []
checkR = 0
checkG = 0
checkN = 0
for i in range (N):
    B.append(int(input()))
for l in range (N):
    for j in range (3):
        for k in range (3):
            if Array[j][k]==B[l]:
                ArrayBingo[j][k]=1
i=0
for i in range (3): 
    if ArrayBingo[i][0] == 1 and ArrayBingo[i][1] == 1 and ArrayBingo[i][2] == 1:
        checkR=1
    else:
        checkR=0
j=0
for j in range (3):
    if ArrayBingo[0][j] == 1 and ArrayBingo[1][j] == 1 and ArrayBingo[2][j] == 1:
        checkG=1
    else:
        checkG=0
if (ArrayBingo[0][0] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][2] == 1) or (ArrayBingo[0][2] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][0] == 1):
    checkN = 1
else:
    checkN = 0
if checkR==1:
    print('Yes')
elif checkG == 1:
    print('Yes')
elif checkN == 1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
Array = [list(map(int,input().split())) for _ in range(3)]
ArrayBingo = [[0,0,0],[0,0,0,],[0,0,0]]
N = int(input())
B = []
checkR = 0
checkG = 0
checkN = 0
for i in range (N):
    B.append(int(input()))
for l in range (N):
    for j in range (3):
        for k in range (3):
            if Array[j][k]==B[l]:
                ArrayBingo[j][k]=1
i=0
for i in range (3): 
    if ArrayBingo[i][0] == 1 and ArrayBingo[i][1] == 1 and ArrayBingo[i][2] == 1:
        checkR=1
    else:
        checkR=0
j=0
for j in range (3):
    if ArrayBingo[0][j] == 1 and ArrayBingo[1][j] == 1 and ArrayBingo[2][j] == 1:
        checkG=1
    else:
        checkG=0
if (ArrayBingo[0][0] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][2] == 1) or (ArrayBingo[0][2] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][0] == 1):
    checkN = 1
else:
    checkN = 0
if checkR==1 or checkG == 1 or checkN == 1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
Array = [list(map(int,input().split())) for _ in range(3)]
ArrayBingo = [[0,0,0],[0,0,0,],[0,0,0]]
N = int(input())
B = []
checkR = 0
checkG = 0
checkN = 0
for i in range (N):
    B.append(int(input()))
for l in range (N):
    for j in range (3):
        for k in range (3):
            if Array[j][k]==B[l]:
                ArrayBingo[j][k]=1
for i in range (3): 
    if ArrayBingo[i][0] == 1 and ArrayBingo[i][1] == 1 and ArrayBingo[i][2] == 1:
        checkR=1
    else:
        checkR=0
for i in range (3):
    if ArrayBingo[0][i]== 1 and ArrayBingo[1][i] ==1 and ArrayBingo[2][i] == 1:
        checkG=1
    else:
        checkG=0
if (ArrayBingo[0][0] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][2] == 1) or (ArrayBingo[0][2] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][0] == 1):
    checkN = 1
else:
    checkN = 0
if checkR==1 or checkG == 1 or checkN == 1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
Array = [list(map(int,input().split())) for _ in range(3)]
ArrayBingo = [[0,0,0],[0,0,0,],[0,0,0]]
N = int(input())
B = []
checkR = 0
checkG = 0
checkN = 0
for i in range (N):
    B.append(int(input()))
    print(B)
for l in range (N):
    for j in range (3):
        for k in range (3):
            if Array[j][k]==B[l]:
                ArrayBingo[j][k]=1
for i in range (3): 
    if ArrayBingo[i][0] == 1 and ArrayBingo[i][1] == 1 and ArrayBingo[i][2] == 1:
        checkR=1
    else:
        checkR=0
for i in range (3):
    if ArrayBingo[0][i]== 1 and ArrayBingo[1][i] ==1 and ArrayBingo[2][i] == 1:
        checkG=1
    else:
        checkG=0
if (ArrayBingo[0][0] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][2] == 1) or (ArrayBingo[0][2] == 1 and ArrayBingo[1][1] == 1 and ArrayBingo [2][0] == 1):
    checkN = 1
else:
    checkN = 0
if checkR==1 or checkG == 1 or checkN == 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())

for _ in range(N):
    b = int(input())
    for i in range(3):
        if b in A[i]:
            A[i][A[i].index(b)] = 0

naname1 = A[0][0] + A[1][1] + A[2][2]
naname2 = A[2][0] + A[1][1] + A[0][2]
yoko = None
if naname1 == 0 or naname2 == 0:
    print('Yes')
    exit()
for i in range(3):
    if A[i].count(0) == 3:
        yoko = 0
    tate = 0
    for j in range(3):
        tate += A[j][i]
    if tate == 0 or yoko == 0:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

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

N = int(input())

for _ in range(N):
    b = int(input())
    for i in range(3):
        if b in A[i]:
            A[i][A[i].index(b)] = 0

naname1 = A[0][0] + A[1][1] + A[2][2]
naname2 = A[2][0] + A[1][1] + A[0][2]
yoko = None
tate = 0
if naname1 == 0 or naname2 == 0:
    print('Yes')
    exit()
for i in range(3):
    if A[i].count(0) == 3:
        yoko = 0

    for j in range(3):
        tate += A[j][i]
    if tate == 0 or yoko == 0:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

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

N = int(input())

for _ in range(N):
    b = int(input())
    for i in range(3):
        if b in A[i]:
            A[i][A[i].index(b)] = 0

naname1 = A[0][0] + A[1][1] + A[2][2]
naname2 = A[2][0] + A[1][1] + A[0][2]
yoko = None
tate = 0
if naname1 == 0 or naname2 == 0:
    print('Yes')
    exit()
for i in range(3):
    if A[i].count(0) == 3:
        yoko = 0

    for j in range(3):
        tate += A[i][j]
    if tate == 0:
        break

if tate == 0 or yoko == 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

N = int(input())

for _ in range(N):
    b = int(input())
    for i in range(3):
        if b in A[i]:
            A[i][A[i].index(b)] = 0

naname1 = A[0][0] + A[1][1] + A[2][2]
naname2 = A[2][0] + A[1][1] + A[0][2]
yoko = None
tate = 0
if naname1 == 0 or naname2 == 0:
    print('Yes')
    exit()
for i in range(3):
    if A[i].count(0) == 3:
        yoko = 0

    for j in range(3):
        tate += A[j][i]
    if tate == 0:
        break

if tate == 0 or yoko == 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
A = []
for i in range(3):
    a1,a2,a3 = list(map(int,input().split()))
    Ai = [a1,a2,a3]
    A.extend(Ai)
n = int(input())
ana = []
for i in range(n):
    b = int(input())
    if b in A:
        idx = A.index(b)
        ana.append(idx)
atari = [[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]]
judje = False
for i in range(len(atari)):
    if (atari[i][0] in ana and atari[i][1] in ana)  and atari[i][1] in ana:
        judje = True
        break
if judje == True:    
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
A = []
for i in range(3):
    a1,a2,a3 = list(map(int,input().split()))
    Ai = [a1,a2,a3]
    A.extend(Ai)
n = int(input())
ana = []
for i in range(n):
    b = int(input())
    if b in A:
        idx = A.index(b)
        ana.append(idx)
atari = [[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,7]]
judje = False
for i in range(len(atari)):
    if (atari[i][0] in ana and atari[i][1] in ana)  and atari[i][1] in ana:
        judje = True
        break
if judje == True:    
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# Author: cr4zjh0bp
# Created: Sat Mar 28 10:36:41 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from collections import defaultdict

a = nan(3)
d = [[0] * 3 for _ in range(3)]
n = ni()
b = nin(n)
dic = defaultdict(int)

for i in range(n):
    dic[b[i]] += 1

for i in range(3):
    for j in range(3):
        d[i][j] = dic[a[i][j]] >= 1

flag = False
for i in range(3):
    cnt = 0
    for j in range(3):
        cnt += d[i][j]
    if cnt == 3:
        flag = True

for i in range(3):
    cnt = 0
    for j in range(3):
        cnt += d[j][i]
    if cnt == 3:
        flag = True

cnt_r = 0
cnt_l = 0
for j in range(3):
    cnt_r += d[j][j]
    cnt_l += d[3 - j - 1][3 - j - 1]
if cnt_r == 3 or cnt_l == 3:
    flag = True

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

Submission status: Wrong Answer

Solution code:
A_1 = list(map(int, input().split()))
A_2 = list(map(int, input().split()))
A_3 = list(map(int, input().split()))
N = int(input())
b = []

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

check = 0
for i in range(3):
    for j in range(N):
        if A_1[i] == b[j]:
            check += 100000000/10**i
        j+=1

for i in range(3):
    for j in range(N):
        if A_2[i] == b[j]:
            check += 100000/10**i
        j+=1

for i in range(3):
    for j in range(N):
        if A_3[i] == b[j]:
            check += 100/10**i
        j+=1
Bingo = ['111000000','111000','111','100100100','10010010','1001001','100110001','1010100','111111111','111111000','111111','110110110','11011011','101010101']
if str(int(check)) in Bingo:
    print('Yes')
else :
    print('No')

Submission status: Wrong Answer

Solution code:
List = [list(map(int,input().split())) for i in range (3)]
N = int(input())
Number = [int(input()) for i in range (N)]
a = 'No'
for k in range(0,3):
    for j in range(0,3):
        for i in range(0,N):
            if Number[i]== List[k][j]:
                List[k][j]=0
            
if List[0] == [0,0,0] or List[1] == [0,0,0] or List[2]== [0,0,0]:
    a = 'Yes'
for m in range(0,2):
    if List[0][m] == 0 and List[1][m] == 0 and List[2][m]==0:
        a ='Yes'
if List[0][0]==0 and List[1][1] == 0 and List[2][2]==0:
    a = 'Yes'
if List[0][2]==0 and List[1][1] == 0 and List[2][0]==0:
    a = 'Yes'
print (a)

Submission status: Wrong Answer

Solution code:
A=[]
A+=list(map(int, input().split()))
A+=list(map(int, input().split()))
A+=list(map(int, input().split()))
N=int(input())

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

found=set()
for num in b:
    if num in A:
        found.add(A.index(num))
BINGO=[{0, 3, 6}, {1, 4, 7}, {2, 5, 8},  {0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 4, 8}, {2, 4, 6}]
for tri in BINGO:
    if tri < found:
        print('Yes')
        break
else:
    print('No')

Submission status: Wrong Answer

Solution code:
A=[]
A+=list(map(int, input().split()))
A+=list(map(int, input().split()))
A+=list(map(int, input().split()))
N=int(input())

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

find=set()
for num in b:
    if num in A:
        find.add(A.index(num))
BINGO=[{0, 3, 6}, {1, 4, 7}, {2, 5, 8},  {0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 4, 8}, {2, 4, 6}]
for tri in BINGO:
    if tri < find:
        print('Yes')
        break
else:
    print('No')

Submission status: Wrong Answer

Solution code:
A=[]
A+=list(map(int, input().split()))
A+=list(map(int, input().split()))
A+=list(map(int, input().split()))
N=int(input())

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

find=set()
for num in b:
    if num in A:
        find.add(A.index(num))

if {0, 3, 6} < find or {1, 4, 7} < find or {2, 5, 8} < find or {0, 1, 2} < find or {3, 4, 5} < find or {6, 7, 8} < find or {0, 4, 8} < find or {2, 4, 6} < find:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
A=[]
A+=list(map(int, input().split()))
A+=list(map(int, input().split()))
A+=list(map(int, input().split()))
N=int(input())

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

print(A, N, b)
find=set()
for num in b:
    if num in A:
        find.add(A.index(num))
print(find)
if {0, 3, 6} < find or {1, 4, 7} < find or {2, 5, 8} < find or {0, 1, 2} < find or {3, 4, 5} < find or {6, 7, 8} < find or {0, 4, 8} < find or {2, 4, 6} < find:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
s,a='036,048,246,258,345,678,',open(0).read().split()
for i in a[9:]:s=s.replace(str(a.index(i)),'')
print('NYoe s'[',,'in s::2])

Submission status: Wrong Answer

Solution code:
A=[]
for i in range(3):
    A.append(list(map(int,input().split())))
N=int(input())
for i in range(N):
    b=int(input())
    for ii in range(3):
        for iii in range(3):
            if A[ii][iii]==b:
                A[ii][iii]=0
print(A)
flag=False
for i in range(3):
    if A[i][:]==[0,0,0]:
        flag=True
    elif A[0][i]==0 and A[1][i]==0 and A[2][i]==0:
            flag=True
    elif A[1][1]==0:
        if A[0][2]==0 and A[2][0]==0:
            flag=True
        elif A[0][0]==0 and A[2][2]==0:
            flag=True
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
A=[]
for i in range(3):
    A.append(list(map(int,input().split())))
N=int(input())
for i in range(N):
    b=int(input())
    for ii in range(3):
        for iii in range(3):
            if A[ii][iii]==b:
                A[ii][iii]=0
print(A)
flag=False
for i in range(3):
    if A[i][:]==[0,0,0]:
        flag=True
    elif A[0][i]==0:
        if A[1][i]==0 and A[2][i]==0:
            flag=True
    elif A[1][1]==0:
        if A[0][2]==0 and A[2][0]==0:
            flag=True
        elif A[0][0]==0 and A[2][2]==0:
            flag=True
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
A=[]
for i in range(3):
    A.append(list(map(int,input().split())))
N=int(input())
for i in range(N):
    b=int(input())
    for ii in range(3):
        for iii in range(3):
            if A[ii][iii]==b:
                A[ii][iii]=0
flag=False
for i in range(3):
    if A[i][:]==[0,0,0] or A[:][i]==[0,0,0]:
        flag=True
    elif A[1][1]==0:
        if A[0][2]==0 and A[2][0]==0:
            flag=True
        elif A[0][0]==0 and A[2][2]==0:
            flag=True
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
number = []
result = "No"

for i in range(3):
	for n in input().split():
		n = int(n)
		number.append(n)

bingo = [None for _ in range(9)]

N  = int(input())
for i in range(N):
	b = int(input())
	for j in range(9):
		if b == number[j]:
			bingo[j] = True

print(bingo)

for i in range(3):
	if bingo[3*i] == bingo[3*i+1] and bingo[3*i+1] == bingo[3*i+2] and bingo[3*i] == True:
		result = "Yes"

for i in range(3):
	if bingo[i] == bingo[3+i] and bingo[3+i] == bingo[6+i] and bingo[i] == True:
		result = "Yes"

if bingo[0] == bingo[4] and bingo[4] == bingo[8] and bingo[0] == True:
	result = "Yes"

if bingo[2] == bingo[4] and bingo[4] == bingo[6] and bingo[2] == True:
	result = "Yes"

print(result)

Submission status: Wrong Answer

Solution code:
import itertools

A = [input().split() for _ in range(3)]
A = list(itertools.chain.from_iterable(A))
N = int(input())
B = [input() for _ in range(N)]

l = [a in B for a in A]
if l[0] == l[1] == l[2]:
    print("Yes")
elif l[3] == l[4] == l[5]:
    print("Yes")
elif l[6] == l[7] == l[8]:
    print("Yes")
elif l[0] == l[3] == l[6]:
    print("Yes")
elif l[1] == l[4] == l[7]:
    print("Yes")
elif l[2] == l[5] == l[8]:
    print("Yes")
elif l[0] == l[4] == l[8]:
    print("Yes")
elif l[2] == l[4] == l[6]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import itertools

A = [input().split() for _ in range(3)]
A = list(itertools.chain.from_iterable(A))
N = int(input())
B = [input() for _ in range(N)]

l = [a in B for a in A]
print(l)
if l[0] == l[1] == l[2]:
    print("Yes")
elif l[3] == l[4] == l[5]:
    print("Yes")
elif l[6] == l[7] == l[8]:
    print("Yes")
elif l[0] == l[3] == l[6]:
    print("Yes")
elif l[1] == l[4] == l[7]:
    print("Yes")
elif l[2] == l[5] == l[8]:
    print("Yes")
elif l[0] == l[4] == l[8]:
    print("Yes")
elif l[2] == l[4] == l[6]:
    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)]

Submission status: Wrong Answer

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

L = []
for number in B:  #すべての数字
    for i in range(3):
        for j in range(3):
            if bingo[i][j] == number:  #ビンゴi行j列が数字と一致
                L.append([i,j])
for i in range(3):
    if [i,0] in L and [i,1] in L and [i,2] in L:
        print('Yes')
        break
    elif [0,i] in L and [1,i] in L and [2,i] in L:
        print('Yes')
        break
    elif [0,0] in L and [1,1] in L and [2,2] in L:
        print('Yes')
        break
    elif [0,2] in L and [1,1] in L and [2,0] in L:
        print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
S = [input().split() for i in range(3)]
N = int(input())
b = [int(i) for i in input().split()]
check = 0

for num in b:
    for i in range(3):
        for j in range(3):
            if S[i][j] == num:
                S[i][j] = '*'

if len(set(S[0])) == 1 or len(set(S[1])) == 1 or len(set(S[2])) == 1:
    check = 1

for i in range(3):
    cnt = 0
    for j in range(3):
        if S[j][i] == '*':
            cnt += 1
    if cnt == 3:
        check = 1

if S[0][0] == S[1][1] == S[2][2] == '*' or S[0][2] == S[1][1] == S[2][0] == '*':
    check = 1

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

Submission status: Wrong Answer

Solution code:
S = [input().split() for i in range(3)]
N = int(input())
b = [int(i) for i in input().split()]
check = 0

for num in b:
    for i in range(3):
        for j in range(3):
            if S[i][j] == num:
                S[i][j] = '*'

if len(set(S[0])) == 1 or len(set(S[1])) == 1 or len(set(S[2])) == 1:
    check = 1

for i in range(3):
    cnt = 0
    for j in range(3):
        if S[j][i] == '*':
            cnt += 1
    if cnt == 3:
        check = 1

if S[0][0] == S[1][1] == S[2][2] == '*' or S[0][2] == S[1][1] == S[2][0] == '*':
    check = 1

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

print(S)

Submission status: Wrong Answer

Solution code:

l=[]
m=[]
b=[]
c=[]
for i in range(3):
            l=list(map(int,input().split()))
            for i in range(3):
                        m.append(l[i])

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

for k in range(n):
            for h in range(9):
                        if b[k]==m[h]:
                                    c.append(h)

if c.count(0)!=0 and c.count(1)!=0 and c.count(2)!=0:
            print('Yes')
elif c.count(0)!=0 and c.count(3)!=0 and c.count(6)!=0:
            print('Yes')
elif c.count(0)!=0 and c.count(4)!=0 and c.count(8)!=0:
            print('Yes')
elif c.count(3)!=0 and c.count(4)!=0 and c.count(5)!=0:
            print('Yes')
elif c.count(1)!=0 and c.count(4)!=0 and c.count(7)!=0:
            print('Yes')
elif c.count(6)!=0 and c.count(7)!=0 and c.count(8)!=0:
            print('Yes')
elif c.count(2)!=0 and c.count(5)!=0 and c.count(8)!=0:
            print('Yes')
else:
            print('No')

Submission status: Wrong Answer

Solution code:

l=[]
m=[]
b=[]
c=[]
for i in range(3):
            l=list(map(int,input().split()))
            for i in range(3):
                        m.append(l[i])
print(m)
n=int(input())
for i in range(n):
            b.append(int(input()))
print('b',b)

for k in range(n):
            for h in range(9):
                        if b[k]==m[h]:
                                    print('b[k]',b[k],'m[h]',m[h])
                                    c.append(h)
print(c)

if c.count(0)!=0 and c.count(1)!=0 and c.count(2)!=0:
            print('Yes')
elif c.count(0)!=0 and c.count(3)!=0 and c.count(6)!=0:
            print('Yes')
elif c.count(0)!=0 and c.count(4)!=0 and c.count(8)!=0:
            print('Yes')
elif c.count(3)!=0 and c.count(4)!=0 and c.count(5)!=0:
            print('Yes')
elif c.count(1)!=0 and c.count(4)!=0 and c.count(7)!=0:
            print('Yes')
elif c.count(6)!=0 and c.count(7)!=0 and c.count(8)!=0:
            print('Yes')
elif c.count(2)!=0 and c.count(5)!=0 and c.count(8)!=0:
            print('Yes')
else:
            print('No')

Submission status: Wrong Answer

Solution code:
def check(A):
	if A[0][0] == 0 and A[1][1] == 0 and A[2][2] == 0:
			return 1
	for i in range(3):
		if A[0][i] == 0 and A[1][i] == 0 and A[2][i] == 0:
			return 1
		elif A[i][0] == 0 and A[i][1] == 0 and A[i][2] == 0:
			return 1
	return 0
			


A = [list(map(int, input().split())) for _ 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

if check(A):
	print('Yes')
else:
	print('No')

Submission status: Wrong Answer

Solution code:
def check(A):
	for i in range(3):
		if A[0][i] == 0 and A[1][i] == 0 and A[2][i] == 0:
			return 1
		elif A[i][0] == 0 and A[i][1] == 0 and A[i][2] == 0:
			return 1
		elif A[0][0] == 0 and A[1][1] == 0 and A[2][2] == 0:
			return 1
	return 0
			


A = [list(map(int, input().split())) for _ 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

if check(A):
	print('Yes')
else:
	print('No')

Submission status: Wrong Answer

Solution code:
A = list()

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

A.append(A1)
A.append(A2)
A.append(A3)

N = int(input())

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

for x in range(N):
    for y in range(3):
        for z in range(3):
            if b[x] == A[y][z]:
                A[y][z] = 101


for i in range(3):
    counter = 0
    for j in range(3):
        if A[i][j] == 101:
            counter += 1
        if counter == 3:
            break
    if counter == 3:
        break
if counter == 3:
    print('Yes')

else:
    counter1 = 0
    for i in range(3):
        if A[i][i] == 101:
            counter1 += 1
    if counter1 == 3:
        print('Yes')
    else:
        counter2 = 0
        for i in range(3):
            if A[i][2-i] == 101:
                counter2 += 1
        if counter2 == 3:
            print('Yes')
        else:
            print('No')