Submission #28487

#TimeUsernameProblemLanguageResultExecution timeMemory
28487이제 내가 두목이다~ (#68)Wine Tasting (FXCUP2_wine)C++11
1 / 1
209 ms5176 KiB
#include <iostream> #include <cstdio> #include <string> #include <vector> #include <queue> #include <stack> #include <algorithm> using namespace std; int main() { int n, k; cin >> n >> k; long long res = 0; vector<int> v; for(int i=0; i<n; i++) { int x; cin >> x; v.push_back(x); } v.push_back(0); sort(v.begin(), v.end()); for(int i=0; i<(k+1)/2; i++) { res += v[v.size()-1-i] - v[i]; } cout << res << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...