結果

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

ソースコード

diff #
raw source code

from sys import stdin


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

    N = int(input())
    if N == 1:
        print(1, 1, flush=1)
        return

    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