結果

問題 No.3598 Queen vs. King
コンテスト
ユーザー detteiuu
提出日時 2026-07-24 21:59:46
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 220 ms / 2,000 ms
+ 3µs
コード長 948 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 246 ms
コンパイル使用メモリ 95,856 KB
実行使用メモリ 85,760 KB
平均クエリ数 2172.00
最終ジャッジ日時 2026-07-24 22:00:54
合計ジャッジ時間 3,389 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def Bob():
    h, w = map(int, input().split())
    return h, w

def Alice(h, w):
    print(h, w)

for _ in range(int(input())):
    c, d = map(int, input().split())
    a, b = 1, 1
    H, W = c, d

    for i in range(3):
        if i == 0:
            c, d = Bob()
            if c == 0 or c == -1: break
            if 4 <= W:
                Alice(1, d-1)
                a, b = 1, d-1
            else:
                Alice(1, d)
                a, b = 1, d
        elif i == 1:
            c, d = Bob()
            if c == 0 or c == -1: break
            if 4 <= W and b == d-2 and d == W:
                Alice(1, d-1)
                b = d-1
            else:
                Alice(c, b)
                a = c
        else:
            c, d = Bob()
            if c == 0 or c == -1: break
            if d == 1:
                Alice(c, d+1)
            else:
                Alice(c, d-1)
    else:
        c, d = map(int, input().split())
0