結果

問題 No.2623 Room Allocation
ユーザー 👑 timitimi
提出日時 2024-02-09 21:42:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 662 ms / 2,000 ms
コード長 353 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 154,184 KB
最終ジャッジ日時 2024-02-09 21:42:12
合計ジャッジ時間 6,647 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
53,460 KB
testcase_01 AC 32 ms
53,460 KB
testcase_02 AC 32 ms
53,460 KB
testcase_03 AC 35 ms
53,460 KB
testcase_04 AC 31 ms
53,460 KB
testcase_05 AC 31 ms
53,460 KB
testcase_06 AC 190 ms
95,124 KB
testcase_07 AC 179 ms
95,124 KB
testcase_08 AC 168 ms
95,124 KB
testcase_09 AC 171 ms
95,124 KB
testcase_10 AC 205 ms
137,260 KB
testcase_11 AC 179 ms
137,260 KB
testcase_12 AC 115 ms
113,680 KB
testcase_13 AC 112 ms
113,680 KB
testcase_14 AC 378 ms
154,184 KB
testcase_15 AC 128 ms
75,760 KB
testcase_16 AC 81 ms
75,760 KB
testcase_17 AC 49 ms
68,708 KB
testcase_18 AC 128 ms
75,776 KB
testcase_19 AC 148 ms
75,776 KB
testcase_20 AC 127 ms
75,776 KB
testcase_21 AC 131 ms
75,760 KB
testcase_22 AC 114 ms
75,776 KB
testcase_23 AC 88 ms
75,776 KB
testcase_24 AC 129 ms
75,776 KB
testcase_25 AC 117 ms
75,760 KB
testcase_26 AC 63 ms
75,776 KB
testcase_27 AC 662 ms
132,948 KB
testcase_28 AC 280 ms
118,144 KB
testcase_29 AC 199 ms
114,984 KB
testcase_30 AC 649 ms
120,236 KB
testcase_31 AC 103 ms
88,384 KB
testcase_32 AC 178 ms
129,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,X,Y=map(int, input().split())

D=[[0,0] for i in range(X+Y)]
for i in range(N):
  c,p=input().split()
  if p=='A':
    p=0
  else:
    p=1
  c=int(c)
  D[i%(X+Y)][p]+=c 

E=[]
for i in range(len(D)):
  x,y=D[i]
  E.append((x-y,i))
E=sorted(E)[::-1]
F=[1]*(X+Y)
for i in range(X):
  F[E[i][1]]=0
ans=0
for i in range(X+Y):
  ans+=D[i][F[i]] 
print(ans)
0