結果

問題 No.2623 Room Allocation
ユーザー 👑 tipstar0125tipstar0125
提出日時 2024-02-14 17:09:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 817 ms / 2,000 ms
コード長 330 bytes
コンパイル時間 582 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 115,784 KB
最終ジャッジ日時 2024-02-14 17:10:02
合計ジャッジ時間 8,549 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 39 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 36 ms
53,460 KB
testcase_04 AC 36 ms
53,460 KB
testcase_05 AC 37 ms
53,460 KB
testcase_06 AC 218 ms
86,304 KB
testcase_07 AC 230 ms
86,688 KB
testcase_08 AC 220 ms
85,920 KB
testcase_09 AC 233 ms
86,688 KB
testcase_10 AC 210 ms
113,480 KB
testcase_11 AC 207 ms
113,480 KB
testcase_12 AC 132 ms
94,508 KB
testcase_13 AC 124 ms
94,508 KB
testcase_14 AC 425 ms
115,784 KB
testcase_15 AC 160 ms
75,780 KB
testcase_16 AC 91 ms
75,780 KB
testcase_17 AC 61 ms
68,692 KB
testcase_18 AC 156 ms
75,792 KB
testcase_19 AC 152 ms
75,792 KB
testcase_20 AC 157 ms
75,792 KB
testcase_21 AC 156 ms
75,780 KB
testcase_22 AC 135 ms
75,792 KB
testcase_23 AC 106 ms
75,792 KB
testcase_24 AC 159 ms
75,792 KB
testcase_25 AC 143 ms
75,788 KB
testcase_26 AC 80 ms
75,800 KB
testcase_27 AC 817 ms
107,320 KB
testcase_28 AC 342 ms
97,052 KB
testcase_29 AC 232 ms
95,556 KB
testcase_30 AC 765 ms
102,600 KB
testcase_31 AC 121 ms
82,724 KB
testcase_32 AC 198 ms
102,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,X,Y=map(int,input().split())
g=[[0 for _ in range(3)] for _ in range(X+Y)]
for i in range(N):
    p,ci=input().split()
    if ci=="A":g[i%(X+Y)][1]+=int(p)
    else:g[i%(X+Y)][2]+=int(p)
    g[i%(X+Y)][0]=g[i%(X+Y)][2]-g[i%(X+Y)][1]
g.sort()

ans=0
for i in range(X+Y):
    if i<X:ans+=g[i][1]
    else:ans+=g[i][2]
print(ans)

0