Problem: 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.

Submission attempts (in order):
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')

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
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 rcnt == 3:
        chk += 1

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

if naname == 3:
    chk += 1

print('YES' if chk > 0 else 'NO')

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()))

result = [[False, False, False], [False, False, False], [False, False, False]]
chk = 0
for r_idx, row in enumerate(table):
    for c_idx, col in enumerate(row):
        result[r_idx][c_idx] = col in p_list


for i in range(3):
    if result[i][0] and result[i][1] and result[i][2]:
        chk += 1
    if result[0][i] and result[1][i] and result[2][i]:
        chk += 1

if result[0][0] and result[1][1] and result[2][2]:
    chk += 1

if result[0][2] and result[1][1] and result[2][0]:
    chk += 1

print('YES' if chk > 0 else 'NO')


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()))

result = [[False, False, False], [False, False, False], [False, False, False]]
chk = 0
for r_idx, row in enumerate(table):
    for c_idx, col in enumerate(row):
        result[r_idx][c_idx] = col in p_list

for i in range(3):
    if result[i][0] and result[i][1] and result[i][2]:
        chk += 1
    if result[0][i] and result[1][i] and result[2][i]:
        chk += 1
    if result[i][i] and result[i][i] and result[i][i]:
        chk += 1

if result[0][2] and result[1][1] and result[2][0]:
    chk += 1

print('YES' if chk > 0 else 'NO')


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()))

result = [[False, False, False], [False, False, False], [False, False, False]]
chk = 0
for r_idx, row in enumerate(table):
    for c_idx, col in enumerate(row):
        result[r_idx][c_idx] = col in p_list


for i in range(3):
    if result[i][0] and result[i][1] and result[i][2]:
        chk += 1
    if result[0][i] and result[1][i] and result[2][i]:
        chk += 1

if result[0][0] and result[1][1] and result[2][2]:
    chk += 1

if result[0][2] and result[1][1] and result[2][0]:
    chk += 1

print('Yes' if chk > 0 else 'No')


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted