結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 36 ms
53,460 KB
testcase_04 AC 36 ms
53,460 KB
testcase_05 AC 36 ms
53,460 KB
testcase_06 AC 225 ms
86,304 KB
testcase_07 AC 234 ms
86,560 KB
testcase_08 AC 225 ms
85,920 KB
testcase_09 AC 261 ms
86,560 KB
testcase_10 AC 234 ms
113,480 KB
testcase_11 AC 225 ms
113,480 KB
testcase_12 AC 139 ms
94,508 KB
testcase_13 AC 137 ms
94,508 KB
testcase_14 AC 482 ms
115,784 KB
testcase_15 AC 161 ms
75,784 KB
testcase_16 AC 91 ms
75,784 KB
testcase_17 AC 65 ms
68,692 KB
testcase_18 AC 166 ms
75,800 KB
testcase_19 AC 158 ms
75,800 KB
testcase_20 AC 163 ms
75,800 KB
testcase_21 AC 190 ms
75,784 KB
testcase_22 AC 142 ms
75,800 KB
testcase_23 AC 111 ms
75,800 KB
testcase_24 AC 163 ms
75,800 KB
testcase_25 AC 146 ms
75,792 KB
testcase_26 AC 80 ms
75,808 KB
testcase_27 AC 883 ms
107,320 KB
testcase_28 AC 356 ms
97,564 KB
testcase_29 AC 242 ms
95,556 KB
testcase_30 AC 847 ms
102,600 KB
testcase_31 AC 130 ms
82,724 KB
testcase_32 AC 212 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()
    a=0
    b=0
    if ci=="A":a=int(p)
    else:b=int(p)
    g[i%(X+Y)][1]+=a
    g[i%(X+Y)][2]+=b
    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