結果
問題 |
No.1149 色塗りゲーム
|
ユーザー |
![]() |
提出日時 | 2020-08-10 20:59:08 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,159 bytes |
コンパイル時間 | 273 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 45,436 KB |
平均クエリ数 | 0.08 |
最終ジャッジ日時 | 2024-07-17 05:44:38 |
合計ジャッジ時間 | 4,138 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 TLE * 1 -- * 46 |
ソースコード
N = int(input()) used = [0 for _ in range(N + 2)] used[0] = 1 used[N + 1] = 1 while True: cnt = 0 for i in range(0, N + 1): if used[i] and not used[i + 1]: cnt += 1 if cnt % 2 == 1: for i in range(0, N): if used[i] and not used[i + 1] and used[i + 2]: used[i + 1] = 1 print(1, i + 1) break else: for i in range(0, N - 1): if used[i] and not used[i + 1] and not used[i + 2] and used[i + 3]: used[i + 1] = 1 used[i + 2] = 1 print(2, i + 1) break else: for i in range(0, N): if not used[i + 1]: used[i + 2] = 1 print(1, i + 2) break t = int(input()) if t == 0: break elif t == 1: raise Exception elif t == 2: raise Exception else: k, x = map(int, input().split()) if k == 1: used[x] = 1 else: used[x] = 1 used[x + 1] = 1