# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28275 | 2017-07-16T04:20:27 Z | ㅁㄴㅇㄹ(#1150, TAMREF, Diuven, suhgyuho_william) | Wine Tasting (FXCUP2_wine) | C++ | 0 ms | 3192 KB |
#include <bits/stdc++.h> using namespace std; int n, k, i, T[300010]; long long res=0; int main(){ scanf("%d%d", &n, &k); for(i=0; i<n; i++) scanf("%d", T+i); sort(T, T+n); for(i=0; i<k; i++){ if(i%2==0) res+=T[n-i/2-1]; else res-=T[i/2]; } printf("%lld", res); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 3192 KB | Output is correct |
2 | Incorrect | 0 ms | 3192 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |