結果
| 問題 | No.2852 Yakitori Optimization Problem |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-25 13:48:02 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 58 ms / 2,000 ms |
| コード長 | 563 bytes |
| 記録 | |
| コンパイル時間 | 1,131 ms |
| コンパイル使用メモリ | 220,092 KB |
| 実行使用メモリ | 16,128 KB |
| 最終ジャッジ日時 | 2026-07-05 12:46:45 |
| 合計ジャッジ時間 | 3,404 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N,K; cin >> N >> K;
vector<int> A(N),B(N),C(N);
for(auto &a : A) cin >> a;
for(auto &a : B) cin >> a;
for(auto &a : C) cin >> a;
long long answer = 0;
for(auto &a : A) answer += a;
for(auto &b : B) answer += b;
vector<int> inc(N);
for(int i=0; i<N; i++) inc.at(i) = C.at(i)-B.at(i);
sort(inc.rbegin(),inc.rend());
for(int i=0; i<N-K; i++) answer += inc.at(i);
cout << answer << endl;
}