結果
問題 | No.1588 Connection |
ユーザー |
![]() |
提出日時 | 2024-04-29 00:01:29 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 611 bytes |
コンパイル時間 | 658 ms |
コンパイル使用メモリ | 82,272 KB |
実行使用メモリ | 85,828 KB |
平均クエリ数 | 2.00 |
最終ジャッジ日時 | 2024-11-17 21:33:02 |
合計ジャッジ時間 | 4,885 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 1 |
other | RE * 31 |
ソースコード
from collections import *N, M = map(int, input().split())Q = deque()Q.append((0, 0))dx = [1, 0, -1, 0]dy = [0, 1, 0, -1]seen = [[0] * N for _ in range(N)]seen[0][0] = 1def query(x, y):print(x, y, flush=True)return input() == "Black"while Q:px, py = Q.popleft()for k in range(4):x = px + dx[k]y = py + dy[k]if x < 0 or x > N - 1 or y < 0 or y > N - 1:continueif seen[x][y]:continueseen[x][y] = 1if query(x, y):Q.append((x, y))print("Yes") if seen[N-1][N-1] else print("No")