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):
import itertools
import sys

[a,b,c] = [int(x) for x in input().split()]
[d,e,f] = [int(x) for x in input().split()]
[g,h,i] = [int(x) for x in input().split()]
N = int(input())
num_list = []
for i in range(N):
  n = int(input())
  num_list.append(n)
set_list = [{a,b,c},{d,e,f},{g,h,i},{a,d,g},{b,e,h},{c,f,i},{a,e,i},{c,e,g}]
the_set = set(num_list) & set([a,b,c,d,e,f,g,h,i])
v = itertools.permutations(the_set,3)
for i in v:
  if i in set_list:
    print('Yes')
    sys.exit()
print('No')


import itertools

[a,b,c] = [int(x) for x in input().split()]
[d,e,f] = [int(x) for x in input().split()]
[g,h,i] = [int(x) for x in input().split()]
N = int(input())
num_list = []
for i in N:
  n = int(input())
  num_list.append(n)
set_list = [{a,b,c},{d,e,f},{g,h,i},{a,d,g},{b,e,h},{c,f,i},{a,e,i}]
the_set = set(num_list) & set([a,b,c,d,e,f,g,h,i])
v = itertools.permutations(the_set,3)
for i in f:
  if i in set_list:
    print('Yes')
    break


import itertools

[a,b,c] = [int(x) for x in input().split()]
[d,e,f] = [int(x) for x in input().split()]
[g,h,i] = [int(x) for x in input().split()]
N = int(input())
num_list = []
for i in N:
  n = int(input())
  num_list.append(n)
set_list = [{a,b,c},{d,e,f},{g,h,i},{a,d,g},{b,e,h},{c,f,i},{a,e,i}]
the_set = set(num_list) & set([a,b,c,d,e,f,g])
v = itertools.permutations(the_set,3)
for i in f:
  if i in set_list:
    print('Yes')
    break


import itertools
import sys

[a,b,c] = [int(x) for x in input().split()]
[d,e,f] = [int(x) for x in input().split()]
[g,h,i] = [int(x) for x in input().split()]
N = int(input())
num_list = []
for i in range(N):
  n = int(input())
  num_list.append(n)
set_list = [{a,b,c},{d,e,f},{g,h,i},{a,d,g},{b,e,h},{c,f,i},{a,e,i}]
the_set = set(num_list) & set([a,b,c,d,e,f,g,h,i])
v = itertools.permutations(the_set,3)
for i in v:
  if i in set_list:
    print('Yes')
    sys.exit()
print('No')


import itertools

[a,b,c] = [int(x) for x in input().split()]
[d,e,f] = [int(x) for x in input().split()]
[g,h,i] = [int(x) for x in input().split()]
N = int(input())
num_list = []
for i in N:
  n = int(input())
  num_list.append(n)
set_list = [{a,b,c},{d,e,f},{g,h,i},{a,d,g},{b,e,h},{c,f,i},{a,e,i}]
the_set = set(N) & set([a,b,c,d,e,f,g])
v = itertools.permutations(the_set,3)
for i in f:
  if i in set_list:
    print('Yes')
    break


import itertools
import sys

[a,b,c] = [int(x) for x in input().split()]
[d,e,f] = [int(x) for x in input().split()]
[g,h,i] = [int(x) for x in input().split()]
N = int(input())
num_list = []
for j in range(N):
  n = int(input())
  num_list.append(n)

set_list = [{a,b,c},{d,e,f},{g,h,i},{a,d,g},{b,e,h},{c,f,i},{a,e,i},{c,e,g}]
the_set = set(num_list) & set([a,b,c,d,e,f,g,h,i])

v = itertools.permutations(the_set,3)
for k in v:
  if set(k) in set_list:
    print('Yes')
    sys.exit()
print('No')


Verdicts: Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Accepted