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:
a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]

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

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

if a[0][2] == -1 and a[1][1] == -1 and a[2][0] == -1:
    exit()

for i in range(3):
    t = []
    for j in range(3):
        if a[i].count(-1) == 3:
            print("Yes")
            exit()
        t.append(a[j][i])
    if t.count(-1) == 3:
        print("Yes")
        exit()

print("No")

Submission status: Wrong Answer

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

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

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

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

for i in range(3):
    t = []
    for j in range(3):
        if a[i].count(-1) == 3:
            print("Yes")
            exit()
        t.append(a[j][i])
    if t.count(-1) == 3:
        print("Yes")
        exit()

print("No")

Submission status: Wrong Answer

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

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

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

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

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

print("No")

Submission status: Wrong Answer

Solution code:
A = [list(map(int, input().split())) for _ in range(3)]
punch = [[0] * 3 for _ in range(3)]
N = int(input())
b = [int(input()) for _ in range(N)]
Yes = 0
for i in range(3):
    for j in range(3):
        for k in range(N):
            if b[k] == A[i][j]:
                punch[i][j] = 1
                break
if punch[0][0] == 1:
    if punch[0][1] == 1:
        if punch[0][2] == 1:
            Yes = 1
            print("Yes")
    elif punch[1][1] == 1:
        if punch[2][2] == 1:
            Yes = 1
            print("Yes")
    elif punch[1][0] == 1:
        if punch[2][0] == 1:
            Yes = 1
            print("Yes")
elif punch[1][0] == 1:
    if punch[1][1] == 1:
        if punch[1][2] == 1:
            Yes = 1
            print("Yes")
elif punch[2][0] == 1:
    if punch[1][0] == 1:
        if punch[0][0] == 1:
            Yes = 1
            print("Yes")
    elif punch[2][1] == 1:
        if punch[2][2] == 1:
            Yes = 1
            print("Yes")
    elif punch[1][1] == 1:
        if punch[0][2] == 1:
            Yes = 1
            print("Yes")
elif punch[0][1] == 1:
    if punch[1][1] == 1:
        if punch[2][1] == 1:
            Yes = 1
            print("Yes")
elif punch[0][2] == 1:
    if punch[0][1] == 1:
        if punch[0][0] == 1:
            Yes = 1
            print("Yes")
    elif punch[2][1] == 1:
        if punch[2][2] == 1:
            Yes = 1
            print("Yes")
    elif punch[1][2] == 1:
        if punch[2][2] == 1:
            Yes = 1
            print("Yes")
if Yes == 0:
    print("No")

Submission status: Wrong Answer

Solution code:
A = [list(map(int, input().split())) for _ in range(3)]
punch = [[0] * 3 for _ in range(3)]
N = int(input())
b = [int(input()) for _ in range(N)]
Yes = 0
for i in range(3):
    for j in range(3):
        for k in range(N):
            if b[k] == A[i][j]:
                punch[i][j] = 1
                break
if punch[0][0] == 1:
    if punch[0][1] == 1:
        if punch[0][2] == 1:
            Yes = 1
            print("Yes")
    elif punch[1][1] == 1:
        if punch[2][2] == 1:
            Yes = 1
            print("Yes")
    elif punch[1][0] == 1:
        if punch[2][0] == 1:
            Yes = 1
            print("Yes")
elif punch[1][0] == 1:
    if punch[1][1] == 1:
        if punch[1][2] == 1:
            Yes = 1
            print("Yes")
elif punch[2][0] == 1:
    if punch[1][0] == 1:
        if punch[0][0] == 1:
            Yes = 1
            print("Yes")
    elif punch[2][1] == 1:
        if punch[2][2] == 1:
            Yes = 1
            print("Yes")
    elif punch[1][1] == 1:
        if punch[0][2] == 1:
            Yes = 1
            print("Yes")
elif punch[0][1] == 1:
    if punch[1][1] == 1:
        if punch[2][1] == 1:
            Yes = 1
            print("Yes")
elif punch[0][2] == 1:
    if punch[0][1] == 1:
        if punch[0][0] == 1:
            Yes = 1
            print("Yes")
    if punch[2][1] == 1:
        if punch[2][2] == 1:
            Yes = 1
            print("Yes")
    if punch[1][2] == 1:
        if punch[2][2] == 1:
            Yes = 1
            print("Yes")
if Yes == 0:
    print("No")

Submission status: Wrong Answer

Solution code:
bingo1 = list(map(int, input().split()))
bingo2 = list(map(int, input().split()))
bingo3 = list(map(int, input().split()))
bingo = bingo1 + bingo2 + bingo3
N = int(input())
bn = [int(input()) for _ in range(N)]
for b in bn:
    bingo = ['x' if i == b else i for i in bingo]

options = [
    [1,2,3], [4,5,6], [7,8,9],
    [1,4,7], [2,5,8], [3,6,9],
    [1,5,9], [3,5,7]
    ]

flag = False
for option in options:
    for i in range(3):
        if bingo[option[i]-1] != 'x':
            continue
        flag = True


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

Submission status: Wrong Answer

Solution code:
bingo1 = list(map(int, input().split()))
bingo2 = list(map(int, input().split()))
bingo3 = list(map(int, input().split()))
bingo = bingo1 + bingo2 + bingo3
N = int(input())
bn = [int(input()) for _ in range(N)]
for b in bn:
    bingo = ['x' if i == b else i for i in bingo]

options = [
    [1,2,3], [4,5,6], [7,8,9],
    [1,4,7], [2,5,8], [3,6,9],
    [1,5,9], [3,5,7]
    ]

flag = False
for option in options:
    for i in range(3):
        if bingo[option[i]-1] != 'x':
            continue
        flag = True
        break

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

Submission status: Wrong Answer

Solution code:
A = [list(map(int, input().split())) for _ in range(3)]
punch = [[0] * 3 for _ in range(3)]
N = int(input())
b = [int(input()) for _ in range(N)]
Yes = 0
for i in range(3):
    for j in range(3):
        for k in range(N):
            if b[k] == A[i][j]:
                punch[i][j] = 1
                break
if punch[0][0] == 1:
    if punch[0][1] == 1:
        if punch[0][2] == 1:
            Yes = 1
            print("Yes")
    elif punch[1][1] == 1:
        if punch[2][2] == 1:
            Yes = 1
            print("Yes")
    elif punch[1][0] == 1:
        if punch[2][0] == 1:
            Yes = 1
            print("Yes")
elif punch[1][0] == 1:
    if punch[1][1] == 1:
        if punch[1][2] == 1:
            Yes = 1
            print("Yes")
elif punch[2][0] == 1:
    if punch[2][1] == 1:
        if punch[2][2] == 1:
            Yes = 1
            print("Yes")
    elif punch[1][1] == 1:
        if punch[0][2] == 1:
            Yes = 1
            print("Yes")
elif punch[0][1] == 1:
    if punch[1][1] == 1:
        if punch[2][1] == 1:
            Yes = 1
            print("Yes")
elif punch[0][2] == 1:
    if punch[1][2] == 1:
        if punch[2][2] == 1:
            Yes = 1
            print("Yes")
if Yes == 0:
    print("No")

Submission status: Wrong Answer

Solution code:
A = [list(map(int, input().split())) for _ in range(3)]
punch = [[0] * 3 for _ in range(3)]
N = int(input())
b = [int(input()) for _ in range(N)]
for i in range(3):
    for j in range(3):
        for k in range(N):
            if b[k] == A[i][j]:
                punch[i][j] = 1
                break
if punch[0][0] == 1:
    if punch[0][1] == 1:
        if punch[0][2] == 1:
            print("Yes")
    elif punch[1][1] == 1:
        if punch[2][2] == 1:
            print("Yes")
    elif punch[1][0] == 1:
        if punch[2][0] == 1:
            print("Yes")
elif punch[1][0] == 1:
    if punch[1][1] == 1:
        if punch[1][2] == 1:
            print("Yes")
elif punch[2][0] == 1:
    if punch[2][1] == 1:
        if punch[2][2] == 1:
            print("Yes")
    elif punch[1][1] == 1:
        if punch[0][2] == 1:
            print("Yes")
elif punch[0][1] == 1:
    if punch[1][1] == 1:
        if punch[2][1] == 1:
            print("Yes")
elif punch[0][2] == 1:
    if punch[1][2] == 1:
        if punch[2][2] == 1:
            print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import numpy as np

A = []
for i in range(3):
  A.append([int(e) for e in input().split()])
A = np.array(A)

mask = np.zeros_like(A)
for i in range(int(input())):
  mask += A == int(input())

def check(mask):
  for i in range(3):
    if (mask[i, 0] * mask[i, 1] * mask[i, 0]) > 0:
      return True
  for i in range(3):
    if (mask[0, i] * mask[1, i] * mask[2, 0]) > 0:
      return True
  
  if (mask[0, 0] * mask[1, 1] * mask[2, 2]) > 0:
    return True
  
  if (mask[0, 2] * mask[1, 1] * mask[2, 0]) > 0:
    return True
  
  return False

print("Yes" if check(mask) else "No")

Submission status: Wrong Answer

Solution code:
import numpy as np

A = []
for i in range(3):
  A.append([int(e) for e in input().split()])
A = np.array(A)

mask = np.zeros_like(A)
for i in range(int(input())):
  mask += A == int(input())

def check(mask):
  for i in range(3):
    if (mask[i, 0] * mask[i, 1] * mask[i, 0]) == 1:
      return True
  for i in range(3):
    if (mask[0, i] * mask[1, i] * mask[2, 0]) == 1:
      return True
  
  if (mask[0, 0] * mask[1, 1] * mask[2, 2]) == 1:
    return True
  
  if (mask[0, 2] * mask[1, 1] * mask[2, 0]) == 1:
    return True
  
  return False

print("Yes" if check(mask) else "No")

Submission status: Wrong Answer

Solution code:
BINGO_ROW_NO = 3

A  = []
for i in range(BINGO_ROW_NO):
    A.append(input().split())

N = int(input())


# ２次元配列検索処理
def SetBingo(A, b):
    for y in range(BINGO_ROW_NO - 1):
        for x in range(BINGO_ROW_NO - 1):
            if A[y][x] == b:
                A[y][x] = ''
                return 
    return 

for _ in range(N):
    b = input()
    SetBingo(A, b)

isBingo = False

# ビンゴチェック
for i in range(BINGO_ROW_NO):
    if A[i][0] == '' and A[i][1] == '' and A[i][2] == '':
        isBingo = True

for i in range(BINGO_ROW_NO):
    if A[0][i] == '' and A[1][i] == '' and A[2][i] == '':
        isBingo = True

for i in range(BINGO_ROW_NO):
    if A[i][i] != '':
        break
    isBingo = True

for i in range(BINGO_ROW_NO):
    if A[i][BINGO_ROW_NO - 1 - i] != '':
        break
    isBingo = True

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

Submission status: Wrong Answer

Solution code:
BINGO_ROW_NO = 3

A  = []
for i in range(BINGO_ROW_NO):
    A.append(input().split())
print(A)

N = int(input())


# ２次元配列検索処理
def SetBingo(A, b):
    for y in range(BINGO_ROW_NO - 1):
        for x in range(BINGO_ROW_NO - 1):
            if A[y][x] == b:
                A[y][x] = ''
                return 
    return 

for _ in range(N):
    b = input()
    SetBingo(A, b)

isBingo = False

# ビンゴチェック
for i in range(BINGO_ROW_NO):
    if A[i][0] == '' and A[i][1] == '' and A[i][2] == '':
        isBingo = True

for i in range(BINGO_ROW_NO):
    if A[0][i] == '' and A[1][i] == '' and A[2][i] == '':
        isBingo = True

for i in range(BINGO_ROW_NO):
    if A[i][i] != '':
        break
    isBingo = True

for i in range(BINGO_ROW_NO):
    if A[i][BINGO_ROW_NO - 1 - i] != '':
        break
    isBingo = True

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

Submission status: Wrong Answer

Solution code:
#Biginner Contest 157 B-Bingo
#二次元配列を使う(3*3)
bingonum=[[0,0,0],[0,0,0],[0,0,0]]
bingo=[["False","False","False"],["False","False","False"],["False","False","False"]]
for i in range(3):
    bingonum[i][0],bingonum[i][1],bingonum[i][2] = map(int,input().split())

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

for x in range(N):
    for i in range(3):
        for j in range(3):
            if bingonum[i][j]==b[x]:
                bingo[i][j]="True"

IsBingo = "No"
for i in range(3):
    if bingo[i][0] =="True" and bingo[i][1] =="True" and bingo[i][2] =="True":
        IsBingo="Yes"
    if bingo[0][i] =="True" and bingo[1][i] =="True" and bingo[2][i] =="True":
        IsBingo="Yes"
if (bingo[0][0] =="True" and bingo[1][1] =="True" and bingo[2][2] =="True") or (bingo[0][2] =="True" and bingo[1][1] =="True" and bingo[2][0]=="True"):
    IsBingo="Yes"
print(IsBingo)

Submission status: Wrong Answer

Solution code:
#Biginner Contest 157 B-Bingo
#二次元配列を使う(3*3)
bingonum=[[0,0,0],[0,0,0],[0,0,0]]
bingo=[["False","False","False"],["False","False","False"],["False","False","False"]]
for i in range(3):
    bingonum[i][0],bingonum[i][1],bingonum[i][2] = map(int,input().split())

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

for x in range(N):
    for i in range(3):
        for j in range(3):
            if bingonum[i][j]==b[x]:
                bingo[i][j]="True"

IsBingo = "No"
for i in range(3):
    if (bingo[i][0] and bingo[i][1] and bingo[i][2])=="True":
        IsBingo="Yes"
    elif (bingo[0][i] and bingo[1][i] and bingo[2][i])=="True":
        IsBingo="Yes"
if (bingo[0][0] and bingo[1][1] and bingo[2][2] =="True") or (bingo[0][2] and bingo[1][1]and bingo[2][0]=="True"):
    IsBingo="Yes"
print(IsBingo)

Submission status: Wrong Answer

Solution code:
bingonum=[[0,0,0],[0,0,0],[0,0,0]]
bingo=[["False","False","False"],["False","False","False"],["False","False","False"]]
for i in range(3):
    bingonum[i][0],bingonum[i][1],bingonum[i][2] = map(int,input().split())

N = int(input())
b=[]
for _ in range(N):
    b.append(input())
for x in range(N):
    for i in range(3):
        for j in range(3):
            if bingonum[i][j]==b[x]:
                bingo[i][j]="True"

IsBingo = "No"
for i in range(3):
    if bingo[i][0] =="True" and bingo[i][1] =="True" and bingo[i][2] =="True":
        IsBingo="Yes"
    if bingo[0][i] =="True" and bingo[1][i] =="True" and bingo[2][i] =="True":
        IsBingo="Yes"
if (bingo[0][0] =="True" and bingo[1][1] =="True" and bingo[2][2] =="True") or (bingo[0][2] =="True" and bingo[1][1] =="True" and bingo[2][0]=="True"):
    IsBingo="Yes"
print(IsBingo)

Submission status: Wrong Answer

Solution code:
#Biginner Contest 157 B-Bingo
#二次元配列を使う(3*3)
bingonum=[[0,0,0],[0,0,0],[0,0,0]]
bingo=[["False","False","False"],["False","False","False"],["False","False","False"]]
for i in range(3):
    bingonum[i][0],bingonum[i][1],bingonum[i][2] = map(int,input().split())

N = int(input())
b=[]
for _ in range(N):
    b.append(input())
for x in range(N):
    for i in range(3):
        for j in range(3):
            if bingonum[i][j]==b[x]:
                bingo[i][j]="True"

IsBingo = "No"
for i in range(3):
    if (bingo[i][0] and bingo[i][1] and bingo[i][2])=="True":
        IsBingo="Yes"
    if (bingo[0][i] and bingo[1][i] and bingo[2][i])=="True":
        IsBingo="Yes"
if (bingo[0][0] and bingo[1][1] and bingo[2][2] =="True") or (bingo[0][2] and bingo[1][1]and bingo[2][0]=="True"):
    IsBingo="Yes"
print(IsBingo)

Submission status: Wrong Answer

Solution code:
#Biginner Contest 157 B-Bingo
#二次元配列を使う(3*3)
bingonum=[[0,0,0],[0,0,0],[0,0,0]]
bingo=[["False","False","False"],["False","False","False"],["False","False","False"]]
for i in range(3):
    bingonum[i][0],bingonum[i][1],bingonum[i][2] = map(int,input().split())

N = int(input())
b=[]
for _ in range(N):
    b.append(input())
for x in range(N):
    for i in range(3):
        for j in range(3):
            if bingonum[i][j]==b[x]:
                bingo[i][j]="True"

IsBingo = "No"
for i in range(3):
    if (bingo[i][0] and bingo[i][1] and bingo[i][2])=="True":
        IsBingo="Yes"
    elif (bingo[0][i] and bingo[1][i] and bingo[2][i])=="True":
        IsBingo="Yes"
if (bingo[0][0] and bingo[1][1] and bingo[2][2] =="True") or (bingo[0][2] and bingo[1][1]and bingo[2][0]=="True"):
    IsBingo="Yes"
print(IsBingo)

Submission status: Wrong Answer

Solution code:
A = [list(map(int,input().split())) for i in range(3)]
n = int(input())
for j in range(n):
  b = int(input())
  for j in range(3):
    for k in range(3): 
    	if b==A[j][k]:
      		A[j][k]=-1

for k in range(3):
  if A[k][:]==[-1,-1,-1]:
    print('Yes')
    exit(0)
 
for k in range(3):
  if sum(A[:][k])==[-1,-1,-1]:
    print('Yes')
    exit(0)
 
if (A[0][0]==A[1][1]==A[2][2]==-1)or(A[2][0]==A[1][1]==A[0][2]==-1): 
    print('Yes')
    exit(0)
    
print('No')

Submission status: Wrong Answer

Solution code:
A = [list(map(int,input().split())) for i in range(3)]
n = int(input())
for j in range(n):
  b = int(input())
  for j in range(3):
    for k in range(3): 
    	if b==A[j][k]:
      		A[j][k]=-1

for k in range(3):
  if A[k][:]==[-1,-1,-1]:
    print('Yes')
    exit(0)
 
for k in range(3):
  if sum(A[:][k])==[-1,-1,-1]:
    print('Yes')
    exit(0)
 
if (A[0][0]==A[1][1]==A[2][2]==[-1,-1,-1])or(A[2][0]==A[1][1]==A[0][2]==[-1,-1,-1]): 
    print('Yes')
    exit(0)
    
print('No')

Submission status: Wrong Answer

Solution code:
A = [list(map(int,input().split())) for i in range(3)]
n = int(input())
for j in range(n):
  b = int(input())
  for j in range(3):
    for k in range(3): 
    	if b==A[j][k]:
      		A[j][k]=-1
print(A)
for k in range(3):
  if A[k][:]==[-1,-1,-1]:
    print('Yes')
    exit(0)
 
for k in range(3):
  if sum(A[:][k])==[-1,-1,-1]:
    print('Yes')
    exit(0)
 
if (A[0][0]==A[1][1]==A[2][2]==[-1,-1,-1])or(A[2][0]==A[1][1]==A[0][2]==[-1,-1,-1]): 
    print('Yes')
    exit(0)
    
print('No')

Submission status: Wrong Answer

Solution code:
lis = []
A = [list(map(int,input().split())) for i in range(3)]
n = int(input())
for j in range(n):
  b = int(input())
  for j in range(3):
    for k in range(3): 
    	if b==A[j][k]:
      		A[j][k]=-1
 
for k in range(3):
  if sum(A[k][:])==-3:
    print('Yes')
    exit(0)
 
for k in range(3):
  if sum(A[:][k])==-3:
    print('Yes')
    exit(0)
 
if (A[0][0]==A[1][1]==A[2][2]==-3)or(A[2][0]==A[1][1]==A[0][2]==-3): 
    print('Yes')
    exit(0)
    
print('No')

Submission status: Wrong Answer

Solution code:
lis = []
A = [list(map(int,input().split())) for i in range(3)]
n = int(input())
for j in range(n):
  b = int(input())
  for li in A:
    if b in li:
      li[li.index(b)]=-1
 
for k in range(3):
  if sum(A[k][:])==-3:
    print('Yes')
    exit(0)
 
for k in range(3):
  if sum(A[:][k])==-3:
    print('Yes')
    exit(0)
 
if (A[0][0]==A[1][1]==A[2][2]==-3)or(A[2][0]==A[1][1]==A[0][2]==-3): 
    print('Yes')
    exit(0)
    
print('No')

Submission status: Wrong Answer

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

for k in range(3):
  if sum(lis[k][:])==0:
    print('Yes')
    exit(0)

for k in range(3):
  if sum(lis[:][k])==0:
    print('Yes')
    exit(0)

if (lis[0][0]+lis[1][1]+lis[2][2]==0)or(lis[2][0]+lis[1][1]+lis[0][2]==0): 
    print('Yes')
    exit(0)
    
print('No')

Submission status: Wrong Answer

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

for k in range(3):
  if sum(lis[k][:])==0:
    print('Yes')
    exit(0)

for k in range(k):
  if sum(lis[:][k])==0:
    print('Yes')
    exit(0)

if (lis[0][0]+lis[1][1]+lis[2][2]==0)or(lis[2][0]+lis[1][1]+lis[0][2]==0): 
    print('Yes')
    exit(0)
    
print('No')

Submission status: Wrong Answer

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

print(lis)
for k in range(3):
  if sum(lis[k][:])==0:
    print('Yes')
    exit(0)

for k in range(k):
  if sum(lis[:][k])==0:
    print('Yes')
    exit(0)

if (lis[0][0]+lis[1][1]+lis[2][2]==0)or(lis[2][0]+lis[1][1]+lis[0][2]==0): 
    print('Yes')
    exit(0)
    
print('No')

Submission status: Wrong Answer

Solution code:
lis = []
for i in range(3):
  a= list(map(int,input().split()))
  lis.append(a)
n = int(input())
for j in range(n):
  b = int(input())
  for li in lis:
    if b in li:
      li[li.index(b)]=0
for k in range(7):
  if k<3:
    if sum(lis[k][:])==0:
      print('Yes')
      exit(0)
  elif (3<=k)and(k<6):
    if sum(lis[:][k-3])==0:
      print('Yes')
      exit(0)
  elif 6<=k:
    if (lis[0][0]+lis[1][1]+lis[2][2]==0)or(lis[2][0]+lis[1][1]+lis[0][2]==0): 
      print('Yes')
      exit(0)
print('No')

Submission status: Wrong Answer

Solution code:
lis = []
for i in range(3):
  a= list(map(int,input().split()))
  lis.append(a)
n = int(input())
for j in range(n):
  b = int(input())
  for li in lis:
    if b in li:
      li[li.index(b)]=0
print(lis)
for k in range(7):
  print(k)
  if k<3:
    if sum(lis[k][:])==0:
      print('Yes')
      exit(0)
  elif (3<=k)and(k<6):
    if sum(lis[:][k-3])==0:
      print('Yes')
      exit(0)
  elif 6<=k:
    if (lis[0][0]+lis[1][1]+lis[2][2]==0)or(lis[2][0]+lis[1][1]+lis[0][2]==0): 
      print('Yes')
      exit(0)
print('No')

Submission status: Wrong Answer

Solution code:
lis = []
for i in range(3):
  a= list(map(int,input().split()))
  lis.append(a)
n = int(input())
for j in range(n):
  b = int(input())
  for li in lis:
    if b in li:
      li[li.index(b)]=0
print(lis)
for k in range(8):
  if k<3:
    if sum(lis[k][:])==0:
      print('Yes')
      exit(0)
  elif (3<=k)and(k<6):
    if sum(lis[:][k-3])==0:
      print('Yes')
      exit(0)
  elif 6<=k:
    if (lis[0][0]+lis[1][1]+lis[2][2]==0)or(lis[2][0]+lis[1][1]+lis[0][2]==0): 
      print('Yes')
      exit(0)
print('No')

Submission status: Wrong Answer

Solution code:
lis = []
for i in range(3):
  a= list(map(int,input().split()))
  lis.append(a)
n = int(input())
for j in range(n):
  b = int(input())
  for li in lis:
    if b in li:
      li[li.index(b)]=0
print(lis)
for k in range(6):
  if k<3 and sum(lis[k][:])==0: 
    print('Yes')
    exit(0)
  elif (3<=k or k<6) and sum(lis[:][k-3])==0:
    print('Yes')
    exit(0)
  elif (lis[0][0]+lis[1][1]+lis[2][2]==0)or(lis[2][0]+lis[1][1]+lis[0][2]==0): 
    print('Yes')
    exit(0)
print('No')

Submission status: Wrong Answer

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

for k in range(3):
  if k<3 and sum(lis[k][:])==0: 
    print('Yes')
    exit(0)
  elif (3<=k or k<6) and sum(lis[:][k-3])==0:
    print('Yes')
    exit(0)
  elif (lis[0][0]+lis[1][1]+lis[2][2]==0)or(lis[2][0]+lis[1][1]+lis[0][2]==0): 
    print('Yes')
    exit(0)
print('No')

Submission status: Wrong Answer

Solution code:
def main():
    import numpy as np

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

    is_bingo = False
    is_bingo = np.sum(card, axis=0).min() == 0
    is_bingo = np.sum(card, axis=1).min() == 0
    is_bingo = np.sum(np.diag(card)) == 0
    is_bingo = np.sum(np.diag(np.fliplr(card))) == 0

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    import numpy as np

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

    is_bingo = False
    is_bingo = np.sum(card, axis=0).min() == 0
    is_bingo = np.sum(card, axis=1).min() == 0
    is_bingo = np.diag(card).min() == 0
    is_bingo = np.diag(np.fliplr(card)).min() == 0

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


if __name__ == '__main__':
    main()

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=list(int(input()) for i in range(N))

for i in range(N):
    for j in range(3):
        if b[i] == A_1[j]:
            A_1[j]=0
        elif b[i] == A_2[j]:
            A_2[j]=0
        elif b[i] == A_3[j]:
            A_3[j]=0

A=A_1+A_2+A_3
if A[0]==A[1] and A[0]==A[2]:
    print('Yes')
elif A[3]==A[4] and A[3]==A[5]:
    print('Yes')
elif A[6]==A[7] and A[6]==A[8]:
    print('Yes')
elif A[0]==A[4] and A[0]==A[8]:
    print('Yes')
elif A[2]==A[4] and A[2]==A[6]:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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


def main():
    bingo_card_number = [map(int, input().split()) for i in range(3)]
    n = int(input())
    number_called = [int(input()) for i in range(n)]

    bingo_card = [[0] * 3] * 3

    for i, row in enumerate(bingo_card_number):
        for j, cell in enumerate(row):
            if cell in number_called:
                bingo_card[i][j] = 1

    result = "No"
    for i in range(3):

        if sum(bingo_card[i]) == 3:
            result = "Yes"

        if bingo_card[0][i] + bingo_card[1][i] + bingo_card[2][i] == 3:
            result = "Yes"

    if bingo_card[0][0] + bingo_card[1][1] + bingo_card[2][2] == 3:
        result = "Yes"

    if bingo_card[2][0] + bingo_card[1][1] + bingo_card[0][2] == 3:
        result = "Yes"

    print(result)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# ２次元配列を１次元配列にする方法
a = sum([input().split() for i in range(3)], [])
# list文字列リストを数値リストに変換
a = [int(i) for i in a]
count = int(input())
if count < 3:
    print("No")
else:
    num = int(input())
    a = [-1 if int(i) == num else i for i in a]
    num = int(input())
    a = [-1 if int(i) == num else i for i in a]
    counter = 3
    d = False
    while (counter <= count):
        counter += 1
        num = int(input())
        a = [-1 if int(i) == num else i for i in a]
        point = sum(i == -1 for i in a)
        if point >= 3:
            d = [(sum(a[0:3]), sum(a[3:6]), sum(a[6:9]), sum(a[0::3]), sum(
                a[1::3]), sum(a[2::3]), sum(a[0::4]), sum(a[2:7:2]))]
            Ans = [True for i in d if i == -3]
        if d:
            print("Yes")
            break
    if not d:
        print("No")

Submission status: Wrong Answer

Solution code:
# ２次元配列を１次元配列にする方法
a = sum([input().split() for i in range(3)], [])
# list文字列リストを数値リストに変換
a = [int(i) for i in a]
count = int(input())
if count < 3:
    print("No")
else:
    num = int(input())
    a = [-1 if int(i) == num else i for i in a]
    num = int(input())
    a = [-1 if int(i) == num else i for i in a]
    counter = 3
    d = False
    while (counter <= count):
        counter += 1
        num = int(input())
        a = [-1 if int(i) == num else i for i in a]
        point = sum(i == -1 for i in a)

        print(a[:])
        if point >= 3:
            d = [(sum(a[0:3]), sum(a[3:6]), sum(a[6:9]), sum(a[0::3]), sum(
                a[1::3]), sum(a[2::3]), sum(a[0::4]), sum(a[2:7:2]))]
            Ans = [True for i in d if i == -3]
        if d:
            print("Yes")
            break
    if not d:
        print("No")

Submission status: Wrong Answer

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

for x in b:
    for i,a in enumerate(A):
        if x in a:
            A[i][a.index(x)] = 0
for i in range(3):
    if sum(A[i])==0 or sum([row[i] for row in A]):
        print("Yes")
        exit()
if A[0][0]+A[1][1]+A[2][2] == 0 or A[0][2]+A[1][1]+A[2][1] == 0:
    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 = [a1,a2,a3]
N = int(input())
b = list()
res = 0
for n in range(N):
  b.append(int(input()))
  for x in range(3):
    for y in range(3):
      if b[n] == a[y][x]:
        a[y][x] = True
def checkh(x):
  for y in range(3):
    if not a[y][x] == True:
      return False
  return True
def checkw(y):
  for x in range(3):
    if not a[y][x] == True:
      return False
  return True
def checks():
  for n in range(3):
    if not a[n][n] == True:
      return False
  return True
def checks2():
  for n in range(2,-1,-1):
    if not a[n][n] == True:
      return False
  return True
for n in range(3):
  if checkw(n) or checkh(n) or checks() or checks2():
    print("Yes")
    exit()
print("No")

Submission status: Wrong Answer

Solution code:
import sys

a = [[0]*3 for _ in range(3)]
a[0] = list(map(int, input().split()))
a[1] = list(map(int, input().split()))
a[2] = list(map(int, input().split()))

n = int(input())
f = [[False]*3 for _ in range(3)]
for _ in range(n):
  b = int(input())
  for i in range(3):
    for j in range(3):
      if a[i][j] == b:
        f[i][j] = True

for i in range(3):
  if (f[i][0] and f[i][1] and f[i][2]):
    print("Yes")
    sys.exit()
if ((f[0][0] and f[1][1] and f[2][2]) or (f[0][2] and f[1][1] and f[2][0])):
  print("Yes")
else:
  print("No")