結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
53,504 KB
testcase_01 AC 42 ms
53,760 KB
testcase_02 AC 44 ms
53,760 KB
testcase_03 AC 43 ms
53,760 KB
testcase_04 AC 42 ms
53,504 KB
testcase_05 AC 43 ms
53,760 KB
testcase_06 AC 86 ms
88,192 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)]
AC = sorted(AC, reverse=True, key=lambda x: x[1])
THREE = collections.defaultdict(list)
for a,c in AC:
    THREE[(int(a)-1)//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