# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
330780 | 2020-11-26T14:40:12 Z | M_W | Stove (JOI18_stove) | C++14 | 1 ms | 364 KB |
#include <bits/stdc++.h> using namespace std; int main(){ int N, K, old, cur; int f, l; vector<int> v; scanf("%d %d %d", &N, &K, &old); f = old; for(int i = 1; i < N; i++){ scanf("%d", &cur); if(i == N - 1) l = cur; v.push_back(cur - old - 1); old = cur; } sort(v.begin(), v.end(), greater<int>()); int ans = l - f + 1, sz = v.size(); for(int i = 0; i < K - 1 && i < sz; i++){ ans -= v[i]; } printf("%d", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 0 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 0 ms | 364 KB | Output is correct |
9 | Incorrect | 0 ms | 364 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 0 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 0 ms | 364 KB | Output is correct |
9 | Incorrect | 0 ms | 364 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 0 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 0 ms | 364 KB | Output is correct |
9 | Incorrect | 0 ms | 364 KB | Output isn't correct |