結果

問題 No.1588 Connection
ユーザー 👑 rin204rin204
提出日時 2022-01-26 17:30:24
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 744 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 97,228 KB
平均クエリ数 562.31
最終ジャッジ日時 2023-08-24 23:05:48
合計ジャッジ時間 7,175 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
87,472 KB
testcase_01 WA -
testcase_02 AC 93 ms
87,220 KB
testcase_03 AC 94 ms
87,188 KB
testcase_04 AC 95 ms
86,920 KB
testcase_05 AC 94 ms
86,992 KB
testcase_06 AC 95 ms
86,956 KB
testcase_07 AC 95 ms
87,468 KB
testcase_08 AC 97 ms
87,468 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 94 ms
86,916 KB
testcase_15 AC 97 ms
87,504 KB
testcase_16 AC 95 ms
87,568 KB
testcase_17 AC 95 ms
87,288 KB
testcase_18 AC 94 ms
87,492 KB
testcase_19 AC 96 ms
87,088 KB
testcase_20 AC 98 ms
87,332 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 194 ms
96,000 KB
testcase_26 AC 194 ms
96,488 KB
testcase_27 AC 131 ms
91,560 KB
testcase_28 AC 121 ms
90,808 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10 ** 9)

n, m = map(int, input().split())
directions = [(1, 0), (0, 1), (0, -1), (-1, 0)]

used = [[False] * n for _ in range(n)]
def dfs(i, j):
    for di, dj in directions:
        ni = i + di
        nj = j + dj
        if ni == -1 or nj == -1 or ni == n or nj == n:
            continue
        if used[ni][nj]:
            continue
        if ni == n - 1 and nj == n - 1:
            print("Yes")
            exit()
        used[ni][nj] = True
        print(ni + 1, nj + 1, flush = True)
        t = input()
        if t == "-1":
            exit()
        elif t == "Black":
            dfs(ni, nj)
        else:
            pass
    
    
    
used[0][0] = True
used[-1][-1] = True
dfs(0, 0)
print("No")
0