結果
| 問題 |
No.2852 Yakitori Optimization Problem
|
| コンテスト | |
| ユーザー |
forest3
|
| 提出日時 | 2025-03-10 15:31:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 288 ms / 2,000 ms |
| コード長 | 429 bytes |
| コンパイル時間 | 1,777 ms |
| コンパイル使用メモリ | 168,596 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-10 15:32:05 |
| 合計ジャッジ時間 | 9,458 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < n; i++)
int main() {
int N, K;
cin >> N >> K;
vector<int> a(N), b(N), c(N);
rep(i, N) cin >> a[i];
rep(i, N) cin >> b[i];
rep(i, N) cin >> c[i];
ll ans = 0;
vector<int> d(N);
rep(i, N) {
ans += a[i] + b[i];
d[i] = c[i] - b[i];
}
sort(d.rbegin(), d.rend());
rep(i, N - K) ans += d[i];
cout << ans << endl;
}
forest3