結果
| 問題 |
No.2042 RGB Caps
|
| コンテスト | |
| ユーザー |
Kude
|
| 提出日時 | 2022-08-19 21:33:33 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 139 ms / 2,000 ms |
| コード長 | 409 bytes |
| コンパイル時間 | 258 ms |
| コンパイル使用メモリ | 82,312 KB |
| 実行使用メモリ | 78,232 KB |
| 最終ジャッジ日時 | 2024-11-16 01:53:21 |
| 合計ジャッジ時間 | 2,696 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 16 |
ソースコード
n, k = map(int, input().split())
d = [-1] * n
for _ in range(k):
a, c = input().split()
d[int(a) - 1] = 'RGB'.find(c)
ans = [0] * n
now = 0
for i in range(n):
if i % 3 == 0:
now = 7
if d[i] == -1 or not now >> d[i] & 1:
k = 0
while not now >> k & 1:
k += 1
else:
k = d[i]
ans[i] = k
now &= ~(1 << k)
print(''.join('RGB'[c] for c in ans))
Kude