結果

問題 No.1588 Connection
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-07-14 23:06:39
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 667 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 96,256 KB
平均クエリ数 1057.78
最終ジャッジ日時 2023-09-24 12:09:58
合計ジャッジ時間 8,629 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
87,612 KB
testcase_01 AC 110 ms
87,656 KB
testcase_02 AC 108 ms
87,572 KB
testcase_03 AC 105 ms
87,172 KB
testcase_04 AC 108 ms
87,692 KB
testcase_05 AC 108 ms
87,484 KB
testcase_06 AC 109 ms
87,156 KB
testcase_07 AC 107 ms
87,616 KB
testcase_08 AC 164 ms
93,908 KB
testcase_09 AC 204 ms
93,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 115 ms
87,788 KB
testcase_15 AC 111 ms
87,048 KB
testcase_16 AC 113 ms
87,616 KB
testcase_17 AC 110 ms
87,724 KB
testcase_18 AC 110 ms
87,424 KB
testcase_19 AC 112 ms
87,256 KB
testcase_20 AC 117 ms
89,172 KB
testcase_21 AC 268 ms
96,016 KB
testcase_22 AC 275 ms
96,256 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 211 ms
94,680 KB
testcase_26 AC 195 ms
94,616 KB
testcase_27 AC 147 ms
92,744 KB
testcase_28 AC 175 ms
93,748 KB
testcase_29 AC 258 ms
94,336 KB
testcase_30 AC 268 ms
93,800 KB
testcase_31 AC 113 ms
87,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque

n,m = map(int,input().split())
count = 0
q = deque([(1,0),(0,1)])
black = [[-1]*n for i in range(n)]
black[0][0] = black[-1][-1] = 1

while q and count < 3000:
    x,y = q.popleft()
    print(x+1,y+1)
    sys.stdout.flush()
    s = input()
    if s == "Black":
        black[x][y] = 1
        for dx,dy in ((0,1),(1,0),(0,-1),(-1,0)):
            nx = x+dx
            ny = y+dy
            if nx == ny == n-1:
                print("Yes")
                exit()
            if 0 <= nx < n and 0 <= ny < n and black[nx][ny] == -1:
                q.append((nx,ny))
    else:
        black[x][y] = 0
    count += 1
print("No")
0