結果

問題 No.2623 Room Allocation
ユーザー titiatitia
提出日時 2024-02-09 22:37:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 630 ms / 2,000 ms
コード長 442 bytes
コンパイル時間 338 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 101,128 KB
最終ジャッジ日時 2024-02-09 22:38:09
合計ジャッジ時間 9,224 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
9,984 KB
testcase_01 AC 25 ms
9,984 KB
testcase_02 AC 24 ms
9,984 KB
testcase_03 AC 24 ms
9,984 KB
testcase_04 AC 24 ms
9,984 KB
testcase_05 AC 25 ms
9,984 KB
testcase_06 AC 310 ms
54,784 KB
testcase_07 AC 300 ms
54,016 KB
testcase_08 AC 320 ms
54,016 KB
testcase_09 AC 296 ms
54,016 KB
testcase_10 AC 333 ms
41,384 KB
testcase_11 AC 325 ms
41,384 KB
testcase_12 AC 202 ms
25,728 KB
testcase_13 AC 186 ms
25,728 KB
testcase_14 AC 630 ms
101,128 KB
testcase_15 AC 307 ms
55,552 KB
testcase_16 AC 74 ms
21,120 KB
testcase_17 AC 26 ms
10,368 KB
testcase_18 AC 277 ms
55,552 KB
testcase_19 AC 270 ms
52,608 KB
testcase_20 AC 271 ms
54,656 KB
testcase_21 AC 273 ms
55,552 KB
testcase_22 AC 224 ms
44,160 KB
testcase_23 AC 114 ms
29,312 KB
testcase_24 AC 268 ms
55,552 KB
testcase_25 AC 215 ms
46,848 KB
testcase_26 AC 40 ms
13,312 KB
testcase_27 AC 629 ms
94,420 KB
testcase_28 AC 316 ms
47,928 KB
testcase_29 AC 284 ms
35,908 KB
testcase_30 AC 612 ms
90,224 KB
testcase_31 AC 90 ms
18,176 KB
testcase_32 AC 259 ms
34,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,X,Y=map(int,input().split())
L=[input().split() for i in range(N)]
mod=X+Y

M=[]
ANS=0
for i in range(mod):
    A=0
    B=0

    for j in range(i,N,mod):
        if L[j][1]=="A":
            A+=int(L[j][0])
        else:
            B+=int(L[j][0])

    M.append((A,B))


M.sort(key=lambda x:x[1]-x[0])

for i in range(mod):
    if i<X:
        ANS+=M[i][0]
    else:
        ANS+=M[i][1]

print(ANS)
0