結果
問題 |
No.2042 RGB Caps
|
ユーザー |
|
提出日時 | 2022-08-19 22:04:21 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,052 bytes |
コンパイル時間 | 409 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 99,216 KB |
最終ジャッジ日時 | 2024-10-08 08:47:25 |
合計ジャッジ時間 | 5,161 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 WA * 9 RE * 2 |
ソースコード
n,k = map(int,input().split()) ans = [] RGB = [0]*3 AC = [] for i in range(k): a,c = input().split() a = int(a) AC.append([a,c]) AC.sort() l = "RGB" now = 0 for i in range(1,n+1): if now < k and AC[now][0] == i: # print(i) c = AC[now][1] now += 1 ind = l.index(c) # print(c,ind,RGB) if max(RGB) == RGB[ind]: if i%3 == 1: RGB[ind] += 1 ans.append(ind) else: m = max(RGB) for j in range(3): if RGB[j] != m: RGB[j] += 1 ans.append(j) break else: RGB[ind] += 1 ans.append(j) else: if i%3 == 1: RGB[0] += 1 ans.append(0) else: m = max(RGB) for j in range(3): if RGB[j] != m: RGB[j] += 1 ans.append(j) ans = [l[i] for i in ans] print("".join(ans))