結果

問題 No.2042 RGB Caps
ユーザー 👑 H20H20
提出日時 2022-08-19 22:11:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 484 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 115,232 KB
最終ジャッジ日時 2024-04-17 00:52:48
合計ジャッジ時間 5,714 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
53,504 KB
testcase_01 AC 50 ms
53,760 KB
testcase_02 AC 46 ms
53,760 KB
testcase_03 AC 46 ms
53,760 KB
testcase_04 AC 47 ms
54,144 KB
testcase_05 AC 47 ms
53,632 KB
testcase_06 AC 91 ms
88,320 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
N,K = map(int, input().split())
AC = [list(input().split()) for _ in range(K)]
for i in range(K):
    AC[i][0]=int(AC[i][0])-1
AC = sorted(AC, reverse=True, key=lambda x: x[1])
THREE = collections.defaultdict(list)
for a,c in AC:
    THREE[a//3].append(c)
HAT = []
for i in range(N//3+1):
    USE = {'R','G','B'}
    for c in THREE[i]:
        if c in USE:
            HAT.append(c)
        USE.discard(c)
    HAT.extend(list(USE))
print(''.join(map(str, HAT[:N])))
0