結果

問題 No.2852 Yakitori Optimization Problem
ユーザー detteiuudetteiuu
提出日時 2024-08-25 13:37:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 471 ms / 2,000 ms
コード長 367 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 144,944 KB
最終ジャッジ日時 2024-08-25 13:37:57
合計ジャッジ時間 7,413 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
92,496 KB
testcase_01 AC 399 ms
122,768 KB
testcase_02 AC 267 ms
125,572 KB
testcase_03 AC 437 ms
144,944 KB
testcase_04 AC 382 ms
133,928 KB
testcase_05 AC 132 ms
93,836 KB
testcase_06 AC 72 ms
81,976 KB
testcase_07 AC 358 ms
132,584 KB
testcase_08 AC 59 ms
74,724 KB
testcase_09 AC 450 ms
138,764 KB
testcase_10 AC 443 ms
138,756 KB
testcase_11 AC 446 ms
138,768 KB
testcase_12 AC 457 ms
139,012 KB
testcase_13 AC 441 ms
139,016 KB
testcase_14 AC 440 ms
139,160 KB
testcase_15 AC 471 ms
139,008 KB
testcase_16 AC 422 ms
138,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

D = []
for i in range(N):
    D.append((A[i], B[i], C[i], B[i]-C[i]))
D.sort(key=lambda x:x[3], reverse=True)

ans = 0
for i in range(K):
    ans += D[i][0]+D[i][1]
for i in range(K, N):
    ans += D[i][0]+D[i][2]

print(ans)
0