Skip to content

Instantly share code, notes, and snippets.

@monchy-monchy
Created July 20, 2021 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save monchy-monchy/0791ea0d79fa9b639dfe515925c2dde7 to your computer and use it in GitHub Desktop.
Save monchy-monchy/0791ea0d79fa9b639dfe515925c2dde7 to your computer and use it in GitHub Desktop.
ABC157 B - Bingo
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 n in range(N)]
# 選ばれた数がビンゴカードにあれば、リストのその要素を 0 に変える。
for b in B:
for i in range(len(A1)):
if A1[i] == b:
A1[i] = 0
if A2[i] == b:
A2[i] = 0
if A3[i] == b:
A3[i] = 0
# 判定用。以下のチェックでビンゴとなっていれば True に変更する。
check = False
# ビンゴの判定【列】
for i in range(len(A1)):
if A1[i] == A2[i] == A3[i] == 0:
check = True
# ビンゴの判定【行】
if sum(A1) == 0 or sum(A2) == 0 or sum(A3) == 0:
check = True
# ビンゴの判定【斜】
if A1[0] == A2[1] == A3[2] == 0 or A1[2] == A2[1] == A3[0] == 0:
check = True
if check:
print("Yes")
else:
print("No")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment