import sys
board = [list(map(int, sys.stdin.readline().split())) for _ in range(19)]
move= [[1,0],[1,1],[0,1],[-1,1]]
N = 19
result = 0
for i in range(N):
for j in range(N):
if board[i][j] != 0:
stone = board[i][j]
for dy, dx in move:
ny, nx, cnt = i + dy, j + dx, 1
while 0 <= ny < N and 0 <= nx < N and board[ny][nx] == stone:
cnt += 1
if cnt == 5:
if 0 <= i - dy < N and 0 <= j - dx < N and board[i-dy][j-dx] == stone:
break
if 0 <= ny + dy < N and 0 <= nx + dx < N and board[ny+dy][nx+dx] == stone:
break
if stone == 1:
result = 1
if stone == 2:
result = 2
y, x = i, j
ny += dy
nx += dx
if result > 0:
print(result)
print(y+1,x+1)
else:
print(0)
'Algorithm > Python' 카테고리의 다른 글
[Algorithm|Python] 백준 27961번 / 99클럽 16일차 TIL (0) | 2025.02.11 |
---|---|
[Algorithm|Python] 백준 15686번 / 99클럽 15일차 TIL (0) | 2025.02.08 |
[Algorithm|Python] 백준 2529번 / 99클럽 13일차 TIL (0) | 2025.02.05 |
[Algorithm|Python] 백준 1051번 / 99클럽 12일차 TIL (0) | 2025.02.05 |
[Algorithm|Python] 백준 1018번 / 99클럽 코테 스터디 11일차 TIL (0) | 2025.02.04 |