結果
問題 | No.2852 Yakitori Optimization Problem |
ユーザー |
![]() |
提出日時 | 2024-08-25 13:37:43 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 89 ms / 2,000 ms |
コード長 | 505 bytes |
コンパイル時間 | 2,127 ms |
コンパイル使用メモリ | 205,780 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-08-25 13:37:51 |
合計ジャッジ時間 | 4,449 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
ソースコード
#include<bits/stdc++.h>using namespace std;int main(){ios::sync_with_stdio(false);cin.tie(nullptr);int N,K;cin>>N>>K;vector<int>D(N);long ans=0;for(int i=0;i<N;i++){int a;cin>>a;ans+=a;}vector<int>B(N),C(N);for(int i=0;i<N;i++)cin>>B[i];for(int i=0;i<N;i++)cin>>C[i],ans+=C[i];for(int i=0;i<N;i++)D[i]=B[i]-C[i];sort(D.begin(),D.end(),greater());for(int i=0;i<K;i++)ans+=D[i];cout<<ans<<endl;}