結果

問題 No.3598 Queen vs. King
コンテスト
ユーザー 👑 loop0919
提出日時 2026-07-24 22:14:42
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 226 ms / 2,000 ms
+ 3µs
コード長 877 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 245 ms
コンパイル使用メモリ 96,364 KB
実行使用メモリ 84,992 KB
平均クエリ数 2284.00
最終ジャッジ日時 2026-07-24 22:18:17
合計ジャッジ時間 3,344 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def receive():
    x, y = [int(s) for s in input().split()]

    if (x, y) in ((0, 0), (-1, -1)):
        is_end = True
    else:
        is_end = False

    return is_end, (x, y)


def put(x, y):
    print(x, y)


def solve():
    H, W = [int(s) for s in input().split()]

    if H >= 4:
        res, _ = receive()
        if res:
            return
        curr_x, curr_y = H - 2, 1
        put(curr_x, curr_y)

    if W >= 4:
        res, _ = receive()
        if res:
            return
        curr_x, curr_y = H - 2, W - 2
        put(curr_x, curr_y)

    res, (x, y) = receive()
    if res:
        return
    if x == H:
        put(H - 1, y)
    else:
        put(x, W - 1)

    res, _ = receive()
    if res:
        return


if __name__ == "__main__":
    T = int(input())

    for _ in range(T):
        solve()

# ......
# ......
# ......
# o.o#..
# ......
# .....
0