結果

問題 No.2623 Room Allocation
ユーザー PNJPNJ
提出日時 2024-02-09 21:45:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 496 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 80,048 KB
最終ジャッジ日時 2024-02-09 21:46:02
合計ジャッジ時間 5,253 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
55,616 KB
testcase_01 AC 41 ms
55,616 KB
testcase_02 AC 41 ms
55,616 KB
testcase_03 AC 40 ms
53,460 KB
testcase_04 AC 41 ms
55,616 KB
testcase_05 AC 40 ms
53,460 KB
testcase_06 AC 180 ms
78,744 KB
testcase_07 WA -
testcase_08 AC 173 ms
79,000 KB
testcase_09 WA -
testcase_10 AC 39 ms
55,616 KB
testcase_11 AC 40 ms
53,460 KB
testcase_12 AC 38 ms
55,616 KB
testcase_13 WA -
testcase_14 AC 172 ms
79,284 KB
testcase_15 AC 161 ms
77,744 KB
testcase_16 WA -
testcase_17 AC 68 ms
70,892 KB
testcase_18 AC 157 ms
77,748 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 161 ms
77,744 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 170 ms
77,748 KB
testcase_25 WA -
testcase_26 AC 78 ms
76,308 KB
testcase_27 AC 198 ms
79,796 KB
testcase_28 AC 115 ms
77,120 KB
testcase_29 AC 91 ms
76,312 KB
testcase_30 AC 196 ms
80,048 KB
testcase_31 AC 78 ms
76,180 KB
testcase_32 AC 79 ms
76,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
def Map():
  return list(map(int,input().split()))

N,X,Y = Map()
x = 0
y = 0
Z = X + Y
C = [0 for i in range(N)]
ans = 0
for i in range(N):
  j = i % Z
  P,c = map(str,input().split())
  P = int(P)
  if c == 'A':
    C[j] += P
  else:
    C[j] -= P
    ans += P

C.sort()
if Z <= N:
  for i in range(X):
    ans += C.pop()
else:
  while len(C) > Y:
    c = C.pop()
    ans += c
  while len(C):
    if C[-1] > 0:
      ans += C.pop()
    else:
      break
print(ans)
0