結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 41 ms
24,024 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 41 ms
23,832 KB
testcase_05 AC 40 ms
24,048 KB
testcase_06 AC 42 ms
23,736 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 44 ms
23,632 KB
testcase_10 AC 45 ms
23,740 KB
testcase_11 AC 45 ms
24,024 KB
testcase_12 AC 85 ms
23,436 KB
testcase_13 AC 93 ms
23,400 KB
testcase_14 AC 42 ms
24,480 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 151 ms
26,432 KB
testcase_22 AC 152 ms
26,024 KB
testcase_23 WA -
testcase_24 AC 65 ms
24,608 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 64 ms
24,580 KB
testcase_28 WA -
testcase_29 AC 155 ms
23,984 KB
testcase_30 WA -
testcase_31 AC 40 ms
23,652 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==3000:
        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==3000:
            break

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