# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28331 | 2017-07-16T04:46:14 Z | lyzqm123(#1136, lyzqm123) | Wine Tasting (FXCUP2_wine) | C++11 | 0 ms | 2288 KB |
#include <cstdio> #include <algorithm> using namespace std; int arr[300001]; int main() { int N, K; scanf("%d%d", &N, &K); for (int n = 0;n < N;n++) scanf("%d", &arr[n]); sort(arr, arr + N); long long ans = arr[N - 1]; if (N >= 2 && K > 2) ans += arr[N - 2] - arr[0]; printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2288 KB | Output is correct |
2 | Correct | 0 ms | 2288 KB | Output is correct |
3 | Incorrect | 0 ms | 2288 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |