結果

問題 No.2623 Room Allocation
ユーザー sasa8uyauyasasa8uyauya
提出日時 2024-02-09 21:55:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 301 ms / 2,000 ms
コード長 288 bytes
コンパイル時間 138 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 132,828 KB
最終ジャッジ日時 2024-02-09 21:55:54
合計ジャッジ時間 6,165 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 37 ms
53,460 KB
testcase_04 AC 37 ms
53,460 KB
testcase_05 AC 37 ms
53,460 KB
testcase_06 AC 201 ms
92,520 KB
testcase_07 AC 201 ms
92,520 KB
testcase_08 AC 202 ms
92,520 KB
testcase_09 AC 201 ms
92,520 KB
testcase_10 AC 121 ms
116,004 KB
testcase_11 AC 118 ms
116,004 KB
testcase_12 AC 90 ms
97,044 KB
testcase_13 AC 86 ms
95,508 KB
testcase_14 AC 268 ms
132,828 KB
testcase_15 AC 178 ms
90,840 KB
testcase_16 AC 93 ms
78,840 KB
testcase_17 AC 64 ms
68,700 KB
testcase_18 AC 180 ms
90,824 KB
testcase_19 AC 170 ms
87,624 KB
testcase_20 AC 203 ms
90,692 KB
testcase_21 AC 178 ms
90,840 KB
testcase_22 AC 153 ms
84,768 KB
testcase_23 AC 118 ms
81,744 KB
testcase_24 AC 182 ms
90,824 KB
testcase_25 AC 156 ms
87,088 KB
testcase_26 AC 77 ms
75,900 KB
testcase_27 AC 301 ms
123,468 KB
testcase_28 AC 162 ms
102,368 KB
testcase_29 AC 131 ms
97,532 KB
testcase_30 AC 267 ms
117,976 KB
testcase_31 AC 85 ms
77,564 KB
testcase_32 AC 130 ms
104,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,x,y=map(int,input().split())
q1=[]
q2=[]
g=0
for i in range(n):
  p,c=input().split()
  p=int(p)
  q1+=[int(c=="B")]
  q2+=[p]
q=[[0]*2 for i in range(x+y)]
for i in range(n):
  q[i%(x+y)][q1[i]]+=q2[i]
g=sum(b for a,b in q)
q=[a-b for a,b in q]
q.sort()
q.reverse()
print(g+sum(q[:x]))
0