結果

問題 No.2623 Room Allocation
ユーザー hato336hato336
提出日時 2024-02-09 21:46:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 350 ms / 2,000 ms
コード長 733 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 153,768 KB
最終ジャッジ日時 2024-02-09 21:46:51
合計ジャッジ時間 8,439 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
84,920 KB
testcase_01 AC 107 ms
84,920 KB
testcase_02 AC 106 ms
84,920 KB
testcase_03 AC 108 ms
84,920 KB
testcase_04 AC 106 ms
84,920 KB
testcase_05 AC 129 ms
84,920 KB
testcase_06 AC 226 ms
113,028 KB
testcase_07 AC 236 ms
111,364 KB
testcase_08 AC 237 ms
111,368 KB
testcase_09 AC 243 ms
111,364 KB
testcase_10 AC 263 ms
153,768 KB
testcase_11 AC 232 ms
153,764 KB
testcase_12 AC 139 ms
103,864 KB
testcase_13 AC 195 ms
120,632 KB
testcase_14 AC 350 ms
151,328 KB
testcase_15 AC 208 ms
98,612 KB
testcase_16 AC 135 ms
91,192 KB
testcase_17 AC 122 ms
89,272 KB
testcase_18 AC 183 ms
98,620 KB
testcase_19 AC 183 ms
98,616 KB
testcase_20 AC 185 ms
98,620 KB
testcase_21 AC 182 ms
98,616 KB
testcase_22 AC 192 ms
96,828 KB
testcase_23 AC 146 ms
94,136 KB
testcase_24 AC 185 ms
98,616 KB
testcase_25 AC 177 ms
97,208 KB
testcase_26 AC 130 ms
89,272 KB
testcase_27 AC 344 ms
139,664 KB
testcase_28 AC 267 ms
119,492 KB
testcase_29 AC 250 ms
118,416 KB
testcase_30 AC 316 ms
132,136 KB
testcase_31 AC 166 ms
99,512 KB
testcase_32 AC 253 ms
133,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
input = sys.stdin.readline
#n = int(input())
#alist = list(map(int,input().split()))
#alist = []
n,x,y = map(int,input().split())
ans = 0
alist = []
for i in range(n):
    p,c = input().split()
    p = int(p)
    alist.append((p,0) if c == 'A' else(p,1))
d = collections.deque()
dp = [[0,0] for i in range(x+y)]
for i in range(x+y):
    j = i
    while j < n:
        dp[i][alist[j][1]] += alist[j][0]
        j += x+y
h = []
ans = 0
for i in range(x+y):
    ans += dp[i][0]
    heapq.heappush(h,-(dp[i][1]-dp[i][0]))
for i in range(y):
    ans -= heapq.heappop(h)
print(ans)
0