結果

問題 No.1149 色塗りゲーム
ユーザー GrayCoder
提出日時 2020-08-07 22:44:33
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 813 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 45,308 KB
平均クエリ数 0.06
最終ジャッジ日時 2024-07-17 05:02:05
合計ジャッジ時間 4,248 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 2 RE * 1 TLE * 1 -- * 46
権限があれば一括ダウンロードができます

ソースコード

diff #

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