結果

問題 No.1588 Connection
ユーザー titiatitia
提出日時 2021-07-08 23:07:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 156 ms / 2,000 ms
コード長 522 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 26,032 KB
平均クエリ数 562.31
最終ジャッジ日時 2023-09-24 11:31:14
合計ジャッジ時間 4,102 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
24,336 KB
testcase_01 AC 41 ms
23,456 KB
testcase_02 AC 46 ms
23,432 KB
testcase_03 AC 42 ms
23,780 KB
testcase_04 AC 41 ms
23,796 KB
testcase_05 AC 41 ms
24,036 KB
testcase_06 AC 42 ms
24,048 KB
testcase_07 AC 40 ms
23,652 KB
testcase_08 AC 44 ms
24,252 KB
testcase_09 AC 45 ms
23,784 KB
testcase_10 AC 45 ms
24,252 KB
testcase_11 AC 45 ms
23,976 KB
testcase_12 AC 86 ms
23,576 KB
testcase_13 AC 93 ms
23,520 KB
testcase_14 AC 41 ms
23,756 KB
testcase_15 AC 42 ms
24,156 KB
testcase_16 AC 41 ms
24,024 KB
testcase_17 AC 42 ms
24,180 KB
testcase_18 AC 41 ms
23,460 KB
testcase_19 AC 42 ms
23,936 KB
testcase_20 AC 47 ms
25,872 KB
testcase_21 AC 150 ms
25,836 KB
testcase_22 AC 151 ms
25,860 KB
testcase_23 AC 85 ms
24,380 KB
testcase_24 AC 64 ms
23,748 KB
testcase_25 AC 98 ms
26,032 KB
testcase_26 AC 97 ms
25,784 KB
testcase_27 AC 66 ms
24,292 KB
testcase_28 AC 58 ms
24,156 KB
testcase_29 AC 156 ms
23,640 KB
testcase_30 AC 156 ms
23,772 KB
testcase_31 AC 41 ms
23,572 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[N-2][N-1]==1 or MAP[N-1][N-2]==1:
    print("Yes",flush=True)
else:
    print("No",flush=True)
0