結果
問題 |
No.2042 RGB Caps
|
ユーザー |
![]() |
提出日時 | 2022-08-19 22:06:19 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 184 ms / 2,000 ms |
コード長 | 449 bytes |
コンパイル時間 | 169 ms |
コンパイル使用メモリ | 81,776 KB |
実行使用メモリ | 93,232 KB |
最終ジャッジ日時 | 2024-11-16 01:56:42 |
合計ジャッジ時間 | 2,973 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 16 |
ソースコード
n,k=map(int,input().split()) a=[-1]*n for i in range(k): ai,ci=input().split() a[int(ai)-1]=ci d={'R':0,'G':1,'B':2} color='RGB' ans=[] cnt=[0]*3 for i in range(n): if a[i]==-1: idx=cnt.index(min(cnt)) ans.append(color[idx]) cnt[idx]+=1 else: c=a[i] if min(cnt)==cnt[d[c]]: ans.append(c) cnt[d[c]]+=1 else: idx=cnt.index(min(cnt)) ans.append(color[idx]) cnt[idx]+=1 print(*ans,sep='')