# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
525184 |
2022-02-11T03:49:29 Z |
InviBull |
Stove (JOI18_stove) |
C++17 |
|
49 ms |
2084 KB |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k, ans = 0;
cin >> n >> k;
vector< int > a(n);
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 1; i < n; i++){
a.push_back(a[i] - a[i - 1] - 1);
}
sort(a.begin() + n, a.end());
for (int i = 0; i < n - k; i++){
ans += a[n + i];
}
cout << ans + n << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
296 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
296 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
288 KB |
Output is correct |
10 |
Correct |
2 ms |
332 KB |
Output is correct |
11 |
Correct |
2 ms |
332 KB |
Output is correct |
12 |
Correct |
2 ms |
332 KB |
Output is correct |
13 |
Correct |
2 ms |
332 KB |
Output is correct |
14 |
Correct |
2 ms |
304 KB |
Output is correct |
15 |
Correct |
2 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
296 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
288 KB |
Output is correct |
10 |
Correct |
2 ms |
332 KB |
Output is correct |
11 |
Correct |
2 ms |
332 KB |
Output is correct |
12 |
Correct |
2 ms |
332 KB |
Output is correct |
13 |
Correct |
2 ms |
332 KB |
Output is correct |
14 |
Correct |
2 ms |
304 KB |
Output is correct |
15 |
Correct |
2 ms |
332 KB |
Output is correct |
16 |
Correct |
44 ms |
1940 KB |
Output is correct |
17 |
Correct |
44 ms |
1932 KB |
Output is correct |
18 |
Correct |
49 ms |
1932 KB |
Output is correct |
19 |
Correct |
48 ms |
1948 KB |
Output is correct |
20 |
Correct |
44 ms |
1936 KB |
Output is correct |
21 |
Correct |
44 ms |
1988 KB |
Output is correct |
22 |
Correct |
47 ms |
2084 KB |
Output is correct |
23 |
Correct |
46 ms |
2016 KB |
Output is correct |
24 |
Correct |
43 ms |
1932 KB |
Output is correct |