結果

問題 No.1588 Connection
ユーザー titiatitia
提出日時 2021-07-08 22:57:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
(最新)
QLE  
(最初)
実行時間 -
コード長 475 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 10,872 KB
実行使用メモリ 26,448 KB
平均クエリ数 562.31
最終ジャッジ日時 2023-09-24 11:26:57
合計ジャッジ時間 4,099 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
23,860 KB
testcase_01 AC 37 ms
24,288 KB
testcase_02 AC 39 ms
23,528 KB
testcase_03 AC 40 ms
23,632 KB
testcase_04 AC 43 ms
23,716 KB
testcase_05 AC 40 ms
24,288 KB
testcase_06 AC 40 ms
24,384 KB
testcase_07 AC 38 ms
23,716 KB
testcase_08 AC 42 ms
24,012 KB
testcase_09 AC 43 ms
23,540 KB
testcase_10 AC 42 ms
23,700 KB
testcase_11 AC 43 ms
24,012 KB
testcase_12 AC 81 ms
23,384 KB
testcase_13 WA -
testcase_14 AC 38 ms
23,556 KB
testcase_15 WA -
testcase_16 AC 38 ms
23,516 KB
testcase_17 AC 39 ms
24,348 KB
testcase_18 AC 38 ms
23,632 KB
testcase_19 AC 39 ms
24,176 KB
testcase_20 AC 43 ms
25,848 KB
testcase_21 WA -
testcase_22 AC 148 ms
26,448 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 95 ms
25,768 KB
testcase_26 WA -
testcase_27 AC 61 ms
24,068 KB
testcase_28 AC 54 ms
23,716 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 38 ms
24,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())

MAP=[[-1]*N for i in range(N)]

MAP[0][0]=1
MAP[N-1][N-1]=1

Q=[(0,0)]

while Q:
    x,y=Q.pop()

    for z,w in [(x+1,y),(x-1,y),(x,y+1),(x,y-1)]:
        if 0<=z<N and 0<=w<N and MAP[z][w]==-1:
            print(z+1,w+1,flush=True)
            a=input()

            if a[0]=="B":
                MAP[z][w]=1
                Q.append((z,w))
            else:
                MAP[z][w]=0

if MAP[z][w]==1:
    print("Yes")
else:
    print("No")
0