結果

問題 No.2623 Room Allocation
ユーザー ああいいああいい
提出日時 2024-02-11 15:32:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 763 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 150,980 KB
最終ジャッジ日時 2024-02-11 15:32:47
合計ジャッジ時間 7,910 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 39 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 35 ms
53,460 KB
testcase_04 AC 34 ms
53,460 KB
testcase_05 AC 34 ms
53,460 KB
testcase_06 AC 192 ms
92,304 KB
testcase_07 AC 199 ms
92,432 KB
testcase_08 AC 193 ms
92,304 KB
testcase_09 AC 194 ms
92,432 KB
testcase_10 AC 206 ms
134,956 KB
testcase_11 AC 205 ms
134,956 KB
testcase_12 AC 123 ms
112,272 KB
testcase_13 AC 134 ms
112,272 KB
testcase_14 AC 467 ms
150,980 KB
testcase_15 AC 153 ms
75,756 KB
testcase_16 AC 86 ms
75,756 KB
testcase_17 AC 60 ms
68,704 KB
testcase_18 AC 154 ms
75,764 KB
testcase_19 AC 152 ms
75,764 KB
testcase_20 AC 152 ms
75,764 KB
testcase_21 AC 156 ms
75,756 KB
testcase_22 AC 135 ms
75,764 KB
testcase_23 AC 108 ms
75,764 KB
testcase_24 AC 159 ms
75,764 KB
testcase_25 AC 145 ms
75,756 KB
testcase_26 AC 75 ms
75,764 KB
testcase_27 AC 763 ms
133,020 KB
testcase_28 AC 336 ms
116,480 KB
testcase_29 AC 238 ms
113,320 KB
testcase_30 AC 718 ms
122,796 KB
testcase_31 AC 116 ms
87,876 KB
testcase_32 AC 200 ms
127,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,X,Y = map(int,input().split())
n = X + Y
dat = [[0] * 2 for _ in range(n)]
A = []
B = []
for _ in range(N):
    P,c = input().split()
    P = int(P)
    if c == "A":
        c = 0
    else:
        c = 1
    dat[_ % n][c] += P
l = []
for i in range(n):
    l.append((dat[i][0] - dat[i][1],i))
l.sort(reverse = True)
ans = 0
for i in range(n):
    if i < X:
        u,j = l[i]
        ans += dat[j][0]
    else:
        u,j = l[i]
        ans += dat[j][1]
print(ans)
0