結果
問題 | No.1588 Connection |
ユーザー | 👑 Kazun |
提出日時 | 2021-07-09 00:54:12 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
(最新)
QLE
(最初)
|
実行時間 | - |
コード長 | 870 bytes |
コンパイル時間 | 245 ms |
コンパイル使用メモリ | 87,256 KB |
実行使用メモリ | 89,828 KB |
平均クエリ数 | 1.00 |
最終ジャッジ日時 | 2023-09-24 11:56:07 |
合計ジャッジ時間 | 5,969 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 116 ms
87,392 KB |
testcase_01 | AC | 114 ms
87,644 KB |
testcase_02 | AC | 116 ms
87,792 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 116 ms
87,332 KB |
testcase_10 | AC | 117 ms
87,796 KB |
testcase_11 | AC | 118 ms
87,560 KB |
testcase_12 | AC | 113 ms
87,852 KB |
testcase_13 | AC | 113 ms
87,532 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 | 118 ms
89,392 KB |
testcase_22 | AC | 121 ms
88,948 KB |
testcase_23 | AC | 115 ms
87,404 KB |
testcase_24 | AC | 120 ms
87,380 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 114 ms
87,476 KB |
testcase_30 | AC | 115 ms
88,040 KB |
testcase_31 | AC | 112 ms
87,960 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[N][N]!=-1: 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")