-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbj_2578.py
More file actions
53 lines (41 loc) · 1.01 KB
/
Copy pathbj_2578.py
File metadata and controls
53 lines (41 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import sys
sys.stdin = open('bj_2578_in.txt', 'r')
input = sys.stdin.readline
coords = dict()
for r in range(5):
row = list(input().strip().split())
for c in range(5):
num = int(row[c])
coords[num] = (r, c)
# print(coords)
row_cnt = [0] * 5
col_cnt = [0] * 5
left_cross = 0
right_cross = 0
cnt = 0
bingo = 0
for _ in range(5):
cmd = list(map(int, input().strip().split()))
for num in cmd:
r, c = coords[num]
cnt += 1
# print(num, bingo)
# 가로 빙고
row_cnt[r] += 1
if row_cnt[r] == 5: bingo += 1
# 세로 빙고
col_cnt[c] += 1
if col_cnt[c] == 5: bingo += 1
# 좌 대각
if r == c:
left_cross += 1
if left_cross == 5: bingo += 1
# 우 대각
if r+c == 4:
right_cross += 1
if right_cross == 5: bingo += 1
if bingo >= 3:
# for row in board:
# print(row)
print(cnt)
sys.exit()