# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28487 | 이제 내가 두목이다~ (#68) | Wine Tasting (FXCUP2_wine) | C++11 | 209 ms | 5176 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |