結果

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

ソースコード

diff #

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