結果

問題 No.2623 Room Allocation
ユーザー ニックネームニックネーム
提出日時 2024-02-09 21:41:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,116 ms / 2,000 ms
コード長 328 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 65,088 KB
最終ジャッジ日時 2024-02-09 21:41:56
合計ジャッジ時間 12,603 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
10,112 KB
testcase_01 AC 24 ms
10,112 KB
testcase_02 AC 24 ms
10,112 KB
testcase_03 AC 26 ms
10,112 KB
testcase_04 AC 25 ms
10,112 KB
testcase_05 AC 25 ms
10,112 KB
testcase_06 AC 538 ms
22,272 KB
testcase_07 AC 540 ms
22,272 KB
testcase_08 AC 529 ms
22,272 KB
testcase_09 AC 522 ms
22,272 KB
testcase_10 AC 269 ms
52,480 KB
testcase_11 AC 251 ms
52,480 KB
testcase_12 AC 147 ms
32,128 KB
testcase_13 AC 121 ms
32,128 KB
testcase_14 AC 797 ms
65,088 KB
testcase_15 AC 492 ms
10,112 KB
testcase_16 AC 142 ms
10,112 KB
testcase_17 AC 29 ms
10,112 KB
testcase_18 AC 526 ms
10,112 KB
testcase_19 AC 465 ms
10,112 KB
testcase_20 AC 497 ms
10,112 KB
testcase_21 AC 490 ms
10,112 KB
testcase_22 AC 394 ms
10,112 KB
testcase_23 AC 228 ms
10,112 KB
testcase_24 AC 500 ms
10,112 KB
testcase_25 AC 413 ms
10,240 KB
testcase_26 AC 62 ms
10,112 KB
testcase_27 AC 1,116 ms
54,664 KB
testcase_28 AC 411 ms
37,636 KB
testcase_29 AC 251 ms
34,152 KB
testcase_30 AC 1,076 ms
49,644 KB
testcase_31 AC 85 ms
18,176 KB
testcase_32 AC 220 ms
40,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,x,y = map(int,input().split())
z = x+y; dab = [[0,0,0] for _ in range(z)]
for i in range(n):
    p,c = input().split()
    p = int(p)
    if c=="A": dab[i%z][0] -= p; dab[i%z][1] += p
    if c=="B": dab[i%z][0] += p; dab[i%z][2] += p
dab.sort(); ans = 0
for d,a,b in dab[:x]: ans += a
for d,a,b in dab[x:]: ans += b
print(ans)
0