結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
23,568 KB
testcase_01 AC 40 ms
24,024 KB
testcase_02 AC 40 ms
24,348 KB
testcase_03 AC 37 ms
24,360 KB
testcase_04 AC 37 ms
24,060 KB
testcase_05 AC 37 ms
24,036 KB
testcase_06 AC 39 ms
23,616 KB
testcase_07 AC 35 ms
24,000 KB
testcase_08 AC 38 ms
24,060 KB
testcase_09 AC 40 ms
23,496 KB
testcase_10 AC 39 ms
24,252 KB
testcase_11 AC 40 ms
23,628 KB
testcase_12 AC 76 ms
24,360 KB
testcase_13 WA -
testcase_14 AC 38 ms
23,964 KB
testcase_15 WA -
testcase_16 AC 37 ms
23,716 KB
testcase_17 AC 36 ms
23,900 KB
testcase_18 AC 37 ms
24,192 KB
testcase_19 AC 37 ms
24,624 KB
testcase_20 AC 43 ms
26,408 KB
testcase_21 WA -
testcase_22 AC 147 ms
25,888 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 98 ms
26,444 KB
testcase_26 WA -
testcase_27 AC 62 ms
24,192 KB
testcase_28 AC 51 ms
24,496 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 34 ms
23,508 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)]

c=0

while Q:
    x,y=Q.pop()
    if c==2998:
        break

    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)
            c+=1
            a=input()

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

        if c==2998:
            break

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