結果

問題 No.2623 Room Allocation
ユーザー fiblonariafiblonaria
提出日時 2024-02-10 05:59:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 223 ms / 2,000 ms
コード長 282 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 86,836 KB
最終ジャッジ日時 2024-02-10 05:59:49
合計ジャッジ時間 5,823 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 35 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 34 ms
53,460 KB
testcase_06 AC 185 ms
78,604 KB
testcase_07 AC 190 ms
78,860 KB
testcase_08 AC 193 ms
78,860 KB
testcase_09 AC 188 ms
78,860 KB
testcase_10 AC 47 ms
68,772 KB
testcase_11 AC 49 ms
68,772 KB
testcase_12 AC 45 ms
64,080 KB
testcase_13 AC 42 ms
61,396 KB
testcase_14 AC 194 ms
86,836 KB
testcase_15 AC 166 ms
75,892 KB
testcase_16 AC 93 ms
75,892 KB
testcase_17 AC 60 ms
68,832 KB
testcase_18 AC 162 ms
75,892 KB
testcase_19 AC 155 ms
75,892 KB
testcase_20 AC 168 ms
75,892 KB
testcase_21 AC 166 ms
75,892 KB
testcase_22 AC 142 ms
75,892 KB
testcase_23 AC 110 ms
75,892 KB
testcase_24 AC 167 ms
75,892 KB
testcase_25 AC 146 ms
75,892 KB
testcase_26 AC 73 ms
75,892 KB
testcase_27 AC 223 ms
85,284 KB
testcase_28 AC 124 ms
81,416 KB
testcase_29 AC 98 ms
80,688 KB
testcase_30 AC 220 ms
83,508 KB
testcase_31 AC 78 ms
77,456 KB
testcase_32 AC 81 ms
82,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, X, Y = map(int, input().split())
diff = [0 for i in range(X + Y)]
ans = 0
for i in range(N):
	P, c = input().split()
	P = int(P)
	c = {'A': 1, 'B': -1}[c]
	diff[i % (X + Y)] += P * c
	ans += P * (1 - c) // 2
diff = sorted(diff)[::-1]
for i in range(X):
	ans += diff[i]
print(ans)
0