結果
| 問題 |
No.2852 Yakitori Optimization Problem
|
| コンテスト | |
| ユーザー |
tottoripaper
|
| 提出日時 | 2024-08-27 02:44:20 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 93 ms / 2,000 ms |
| コード長 | 724 bytes |
| コンパイル時間 | 2,117 ms |
| コンパイル使用メモリ | 201,464 KB |
| 最終ジャッジ日時 | 2025-02-24 02:25:50 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using ll = std::int64_t;
int main(){
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
int N, K;
std::cin >> N >> K;
std::vector<ll> A(N), B(N), C(N);
for(int i=0;i<N;i++){
std::cin >> A[i];
}
for(int i=0;i<N;i++){
std::cin >> B[i];
}
for(int i=0;i<N;i++){
std::cin >> C[i];
}
ll res = std::accumulate(std::begin(A), std::end(A), 0ll) + std::accumulate(std::begin(C), std::end(C), 0ll);
std::vector<ll> D(N);
for(int i=0;i<N;i++){
D[i] = B[i] - C[i];
}
std::sort(std::rbegin(D), std::rend(D));
res += std::accumulate(D.begin(), D.begin() + K, 0ll);
std::cout << res << std::endl;
}
tottoripaper