結果

問題 No.1588 Connection
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-07-14 23:13:48
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 669 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 87,196 KB
実行使用メモリ 97,244 KB
平均クエリ数 674.91
最終ジャッジ日時 2023-09-24 12:10:07
合計ジャッジ時間 8,185 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 112 ms
87,480 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 109 ms
87,808 KB
testcase_05 AC 111 ms
87,236 KB
testcase_06 AC 114 ms
87,484 KB
testcase_07 RE -
testcase_08 AC 149 ms
92,968 KB
testcase_09 AC 203 ms
93,856 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 115 ms
87,820 KB
testcase_15 AC 115 ms
87,440 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 279 ms
95,996 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 AC 225 ms
95,904 KB
testcase_26 RE -
testcase_27 AC 156 ms
93,228 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 273 ms
93,964 KB
testcase_31 RE -
権限があれば一括ダウンロードができます

ソースコード

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[nx][ny] = 0
    count += 1
print("No")
0