結果
| 問題 |
No.1588 Connection
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2023-12-21 09:59:16 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 478 bytes |
| コンパイル時間 | 169 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 29,528 KB |
| 平均クエリ数 | 2.00 |
| 最終ジャッジ日時 | 2024-09-27 10:51:58 |
| 合計ジャッジ時間 | 3,797 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 31 |
ソースコード
N,M=map(int,input().split())
queue=[(0,0)]
seen=[[False]*N for x in range(N)]
seen[0][0]=True
while queue:
x,y=queue.pop()
for dx,dy in ((0,1),(1,0),(0,-1),(-1,0)):
xx=x+dx
yy=y+dy
if (xx,yy)==(N-1,N-1):
print("Yes")
exit()
if 0<=xx<N and 0<=yy<N and not seen[xx][yy]:
print(xx+1,yy+1)
S=input()
if S=="black":
queue.append((xx,yy))
seen[xx][yy]=True
vwxyz