結果

問題 No.2623 Room Allocation
ユーザー 👑 rin204rin204
提出日時 2024-02-10 00:52:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 174 ms / 2,000 ms
コード長 266 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 81,844 KB
最終ジャッジ日時 2024-02-10 00:52:39
合計ジャッジ時間 5,359 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
53,460 KB
testcase_01 AC 32 ms
53,460 KB
testcase_02 AC 34 ms
53,460 KB
testcase_03 AC 35 ms
53,460 KB
testcase_04 AC 34 ms
53,460 KB
testcase_05 AC 35 ms
53,460 KB
testcase_06 AC 151 ms
77,556 KB
testcase_07 AC 165 ms
77,172 KB
testcase_08 AC 141 ms
77,172 KB
testcase_09 AC 145 ms
77,172 KB
testcase_10 AC 38 ms
61,496 KB
testcase_11 AC 40 ms
61,496 KB
testcase_12 AC 34 ms
54,996 KB
testcase_13 AC 37 ms
59,860 KB
testcase_14 AC 150 ms
81,844 KB
testcase_15 AC 139 ms
75,752 KB
testcase_16 AC 87 ms
75,752 KB
testcase_17 AC 56 ms
68,708 KB
testcase_18 AC 141 ms
75,768 KB
testcase_19 AC 133 ms
75,768 KB
testcase_20 AC 158 ms
75,768 KB
testcase_21 AC 143 ms
75,752 KB
testcase_22 AC 121 ms
75,768 KB
testcase_23 AC 103 ms
75,768 KB
testcase_24 AC 139 ms
75,768 KB
testcase_25 AC 121 ms
75,756 KB
testcase_26 AC 62 ms
75,768 KB
testcase_27 AC 174 ms
81,828 KB
testcase_28 AC 114 ms
78,456 KB
testcase_29 AC 89 ms
78,512 KB
testcase_30 AC 172 ms
80,548 KB
testcase_31 AC 63 ms
74,512 KB
testcase_32 AC 68 ms
77,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, x, y = map(int, input().split())
z = x + y
C = [0] * z
ans = 0
for i in range(n):
    p, c = input().split()
    p = int(p)
    if c == "A":
        ans += p
        C[i % z] -= p
    else:
        C[i % z] += p

C.sort(reverse=True)
ans += sum(C[:y])
print(ans)
0