結果
| 問題 |
No.1588 Connection
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2023-12-21 10:00:30 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 161 ms / 2,000 ms |
| コード長 | 490 bytes |
| コンパイル時間 | 114 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 29,144 KB |
| 平均クエリ数 | 543.84 |
| 最終ジャッジ日時 | 2024-09-27 10:52:20 |
| 合計ジャッジ時間 | 4,508 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 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
print("No")
vwxyz