# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28422 | 일단아무거나적어놓은팀이름 (#68) | Wine Tasting (FXCUP2_wine) | C++14 | 96 ms | 3192 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<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int n, k, a[300001];
int main() {
scanf("%d%d", &n, &k);
for(int i = 0; i < n; ++i) {
scanf("%d", a + i);
}
sort(a, a + n);
long long res = a[n - 1];
for(int i = 0; i < (k - 1) / 2; ++i) {
res += a[n - i - 2] - a[i];
}
printf("%lld", res);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |