結果

問題 No.2852 Yakitori Optimization Problem
ユーザー miya145592miya145592
提出日時 2024-08-25 13:41:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 731 ms / 2,000 ms
コード長 382 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 82,536 KB
実行使用メモリ 146,188 KB
最終ジャッジ日時 2024-08-25 13:41:40
合計ジャッジ時間 10,332 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
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 b, c in zip(B, C):
    D.append((b-c, b, c))
D.sort()
ans = sum(A)
for i in range(N-K):
    _, b, c = D[i]
    ans += c
for i in range(N-K, N):
    _, b, c = D[i]
    ans += b
print(ans)
    
0