結果

問題 No.2623 Room Allocation
ユーザー rlangevinrlangevin
提出日時 2024-02-09 21:37:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 650 ms / 2,000 ms
コード長 419 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 116,648 KB
最終ジャッジ日時 2024-02-09 21:37:29
合計ジャッジ時間 6,094 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,460 KB
testcase_01 AC 33 ms
53,460 KB
testcase_02 AC 32 ms
53,460 KB
testcase_03 AC 33 ms
53,460 KB
testcase_04 AC 33 ms
53,460 KB
testcase_05 AC 33 ms
53,460 KB
testcase_06 AC 122 ms
86,060 KB
testcase_07 AC 118 ms
85,676 KB
testcase_08 AC 119 ms
85,676 KB
testcase_09 AC 114 ms
85,676 KB
testcase_10 AC 156 ms
114,344 KB
testcase_11 AC 162 ms
114,344 KB
testcase_12 AC 105 ms
94,092 KB
testcase_13 AC 107 ms
94,092 KB
testcase_14 AC 327 ms
116,648 KB
testcase_15 AC 89 ms
75,296 KB
testcase_16 AC 58 ms
75,296 KB
testcase_17 AC 41 ms
62,100 KB
testcase_18 AC 88 ms
75,292 KB
testcase_19 AC 86 ms
75,296 KB
testcase_20 AC 86 ms
75,292 KB
testcase_21 AC 89 ms
75,292 KB
testcase_22 AC 78 ms
75,292 KB
testcase_23 AC 65 ms
75,296 KB
testcase_24 AC 89 ms
75,296 KB
testcase_25 AC 82 ms
75,292 KB
testcase_26 AC 48 ms
68,256 KB
testcase_27 AC 650 ms
108,184 KB
testcase_28 AC 266 ms
98,044 KB
testcase_29 AC 190 ms
96,164 KB
testcase_30 AC 628 ms
103,080 KB
testcase_31 AC 85 ms
82,368 KB
testcase_32 AC 155 ms
103,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, X, Y = map(int, input().split())
M = X + Y
D = [[0, 0, 0] for _ in range(M)]
for i in range(N):
    P, c = input().split()
    P = int(P)
    if c == "A":
        D[i%M][1] += P
    else:
        D[i%M][2] += P
        
ans = 0
for i in range(M):
    ans += D[i][2]
    D[i][0] = D[i][1] - D[i][2]
    
D.sort(reverse=True)
for i in range(X):
    ans += D[i][0]
    
print(ans)
0