# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28260 | Sorry AcornCkiGuiziTeam (#68) | Wine Tasting (FXCUP2_wine) | C++14 | 103 ms | 2288 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 <algorithm>
using namespace std;
int a[300003];
int main() {
long long r = 0;
int i, n, m;
scanf("%d%d", &n, &m);
for (i = 1; i <= n; i++) scanf("%d", &a[i]);
sort(a, a + n + 1);
for (i = 0; i + i < m; i++) r += a[n - i] - a[i];
printf("%lld", r);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |