# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
559932 | 2022-05-11T01:17:39 Z | hibiki | Stove (JOI18_stove) | C++11 | 20 ms | 1800 KB |
#include<bits/stdc++.h> using namespace std; #define pb push_back #define f first #define s second int n,k; vector<int> v; int main() { scanf("%d %d",&n,&k); int lst = 0, fi; scanf("%d",&lst); fi = lst; for(int i = 1; i < n; i++) { int a; scanf("%d",&a); v.pb(a - (lst + 1)); lst = a; } sort(v.begin(),v.end()); int all = lst + 1 - fi; for(int i = v.size() - 1, j = 0; i >= 0 && j < k - 1 ; i--, j++) all -= v[i]; printf("%d\n",all); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 296 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 296 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 312 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 308 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 296 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 312 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 308 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 18 ms | 1776 KB | Output is correct |
17 | Correct | 19 ms | 1744 KB | Output is correct |
18 | Correct | 18 ms | 1800 KB | Output is correct |
19 | Correct | 20 ms | 1744 KB | Output is correct |
20 | Correct | 18 ms | 1776 KB | Output is correct |
21 | Correct | 18 ms | 1748 KB | Output is correct |
22 | Correct | 18 ms | 1708 KB | Output is correct |
23 | Correct | 18 ms | 1760 KB | Output is correct |
24 | Correct | 18 ms | 1724 KB | Output is correct |