結果

問題 No.2623 Room Allocation
ユーザー lloyzlloyz
提出日時 2024-02-12 19:08:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 899 ms / 2,000 ms
コード長 439 bytes
コンパイル時間 503 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 147,504 KB
最終ジャッジ日時 2024-02-12 19:09:05
合計ジャッジ時間 8,996 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 35 ms
53,460 KB
testcase_03 AC 35 ms
53,460 KB
testcase_04 AC 35 ms
53,460 KB
testcase_05 AC 35 ms
53,460 KB
testcase_06 AC 214 ms
89,368 KB
testcase_07 AC 206 ms
89,368 KB
testcase_08 AC 205 ms
89,368 KB
testcase_09 AC 207 ms
89,368 KB
testcase_10 AC 223 ms
144,688 KB
testcase_11 AC 217 ms
144,688 KB
testcase_12 AC 132 ms
109,972 KB
testcase_13 AC 132 ms
109,972 KB
testcase_14 AC 505 ms
147,504 KB
testcase_15 AC 154 ms
75,896 KB
testcase_16 AC 85 ms
75,896 KB
testcase_17 AC 59 ms
68,844 KB
testcase_18 AC 154 ms
75,908 KB
testcase_19 AC 147 ms
75,908 KB
testcase_20 AC 152 ms
75,908 KB
testcase_21 AC 154 ms
75,896 KB
testcase_22 AC 132 ms
75,908 KB
testcase_23 AC 105 ms
75,908 KB
testcase_24 AC 155 ms
75,908 KB
testcase_25 AC 136 ms
75,896 KB
testcase_26 AC 72 ms
75,908 KB
testcase_27 AC 899 ms
130,720 KB
testcase_28 AC 370 ms
114,052 KB
testcase_29 AC 253 ms
111,404 KB
testcase_30 AC 858 ms
122,416 KB
testcase_31 AC 120 ms
87,892 KB
testcase_32 AC 211 ms
123,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, x, y = map(int, input().split())
xy = x + y
C = [[0, 0] for _ in range(xy)]
for i in range(n):
    p, c = input().split()
    p = int(p)
    if c == 'A':
        j = 0
    else:
        j = 1
    C[i % xy][j] += p
D = [(C[i][0] - C[i][1], i) for i in range(xy)]
D.sort(key=lambda x: (x[0], x[1]), reverse=True)
ans = 0
for i in range(xy):
    j = D[i][1]
    if i < x:
        ans += C[j][0]
    else:
        ans += C[j][1]
print(ans)
0