結果

問題 No.1149 色塗りゲーム
コンテスト
ユーザー keijak
提出日時 2021-04-19 21:46:22
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 179 ms / 2,000 ms
コード長 606 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 350 ms
コンパイル使用メモリ 20,828 KB
実行使用メモリ 34,440 KB
平均クエリ数 19.82
最終ジャッジ日時 2026-04-01 01:50:28
合計ジャッジ時間 10,328 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n = int(input())

if n <= 2:
    print(n, 1, flush=True)
    t = int(input())
    assert t == 0
    exit(0)


rem = n

if n & 1:
    mid = (n + 1) // 2
    print(1, mid, flush=True)
    rem -= 1
else:
    mid = n // 2
    print(2, mid, flush=True)
    rem -= 2
assert rem % 2 == 0

while True:
    t = int(input())
    if t in [0, 1]:
        exit(0)
    k, x = [int(x) for x in input().split()]
    if x < mid:
        y = n + 1 - x
        if k == 2:
            y -= 1
        print(k, y, flush=True)
    else:
        if k == 2:
            x += 1
        y = n + 1 - x
        print(k, y, flush=True)
0