結果
問題 | No.1588 Connection |
ユーザー | 👑 Kazun |
提出日時 | 2021-07-09 00:53:25 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
(最新)
QLE
(最初)
|
実行時間 | - |
コード長 | 866 bytes |
コンパイル時間 | 281 ms |
コンパイル使用メモリ | 86,976 KB |
実行使用メモリ | 96,208 KB |
平均クエリ数 | 487.38 |
最終ジャッジ日時 | 2023-09-24 11:56:15 |
合計ジャッジ時間 | 7,058 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 116 ms
87,556 KB |
testcase_01 | AC | 114 ms
87,456 KB |
testcase_02 | AC | 119 ms
87,824 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 125 ms
87,784 KB |
testcase_10 | AC | 123 ms
87,920 KB |
testcase_11 | AC | 122 ms
87,752 KB |
testcase_12 | AC | 193 ms
94,692 KB |
testcase_13 | AC | 219 ms
94,036 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 231 ms
96,208 KB |
testcase_22 | AC | 267 ms
96,100 KB |
testcase_23 | AC | 201 ms
94,820 KB |
testcase_24 | AC | 159 ms
93,604 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 297 ms
94,576 KB |
testcase_30 | AC | 276 ms
94,364 KB |
testcase_31 | AC | 117 ms
87,296 KB |
ソースコード
def question(a,b): print(a,b,flush=True) ans=input() if ans[0]=="B": return 1 elif ans[0]=="W": return 0 else: exit() def answer(ans): exit(print(ans,flush=True)) #================================================= from collections import deque N,M=map(int,input().split()) # 自明な否定 if 2*N-1>M: answer("No") X=[[-1]*(N+1) for _ in range(N+1)] X[1][1]=X[N][N]=1 Remain=M-2 Q=deque([(1,1)]) T=[(1,0),(-1,0),(0,1),(0,-1)] while Q: x,y=Q.popleft() if Remain==0: break if x==y==N: break for a,b in T: p=x+a; q=y+b if 1<=p<=N and 1<=q<=N and X[p][q]==-1 and (N-p)+(N-q)<=Remain: X[p][q]=quest=question(p,q) if quest: Q.append((p,q)) Remain-=1 answer("Yes" if X[N][N]==1 else "No")