結果

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

ソースコード

diff #
raw source code

def main():
    h, w = list(map(int, input().split()))
    if h == w:
        x, y = list(map(int, input().split()))
        print(h-1, w-1)
        x, y = list(map(int, input().split()))
        if (x, y) == (0, 0):
            return
    else:
        y, x = list(map(int, input().split()))
        if (y, x) != (h-1, w-1):
            if y != h-1:
                print(h-1, 1)
                y, x = list(map(int, input().split()))
                if (y, x) == (0, 0): return
                print(h-1, x)
                y, x = list(map(int, input().split()))
                if (y, x) == (0, 0): return
            else:
                print(1, w-1)
                y, x = list(map(int, input().split()))
                if (y, x) == (0, 0): return
                print(y, w-1)
                y, x = list(map(int, input().split()))
                if (y, x) == (0, 0): return
        else:
            if h == 3:
                print(1, w-2)
                y, x = list(map(int, input().split()))
                if (y, x) == (0, 0): return
                print(y, w-2)
                y, x = list(map(int, input().split()))
                if (y, x) == (0, 0): return
                print(y, w-1)
                y, x = list(map(int, input().split()))
                if (y, x) == (0, 0): return
            else:
                print(h-2, 1)
                y, x = list(map(int, input().split()))
                if (y, x) == (0, 0): return
                print(h-2, x)
                y, x = list(map(int, input().split()))
                if (y, x) == (0, 0): return
                print(h-1, x)
                y, x = list(map(int, input().split()))
                if (y, x) == (0, 0): return

for _ in range(int(input())):
    main()
0