結果

問題 No.1149 色塗りゲーム
コンテスト
ユーザー GrayCoder
提出日時 2020-08-07 23:03:48
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
RE  
実行時間 -
コード長 813 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 580 ms
コンパイル使用メモリ 20,956 KB
実行使用メモリ 39,224 KB
平均クエリ数 0.06
最終ジャッジ日時 2026-03-31 21:04:06
合計ジャッジ時間 6,921 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 2 RE * 1 TLE * 1 -- * 46
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]

    N = int(input())
    grid = [0] * (N + 1)
    while 1:
        if N % 2:
            k = 2
        else:
            k = 1
        for x in range(1, N + 1):
            y = x + k - 1
            if not grid[x]:
                if k == 1:
                    print(k, x, flush=1)
                    grid[x] = 1
                    break
                elif not grid[y]:
                    print(k, x, flush=1)
                    grid[x] = 1
                    grid[y] = 1
                    break

        t = int(input())
        if not t or t == 1:
            return
        k, x = map(int, input().split())
        if t == 2:
            return
        grid[x - 1] = 1
        grid[x + k - 1] = 1
        N -= k


main()
0