# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28465 | 뚜룹뚜룹뚜룹뚜스~>< (#68) | Wine Tasting (FXCUP2_wine) | C++98 | 96 ms | 3460 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>
#define ll long long
using namespace std;
int n, m;
ll res, now;
ll arr[300010];
int main(){
int i;
scanf("%d %d", &n, &m);
for(i = 0; i < n; i++) scanf("%lld", &arr[i]);
sort(arr, arr + n);
for(i = 0; i < m; i += 2){
res += arr[n - i / 2 - 1] - now;
now = arr[i / 2];
}
printf("%lld", res);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |