# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
45125 | 2018-04-11T11:17:20 Z | Pajaraja | Stove (JOI18_stove) | C++17 | 36 ms | 10404 KB |
#include <bits/stdc++.h> int t[100007],a[100007]; int main() { int n,k; scanf("%d%d",&n,&k); for(int i=0;i<n;i++) scanf("%d",&t[i]); int al=t[n-1]+1-t[0]; for(int i=0;i<n-1;i++) a[i]=t[i+1]-t[i]-1; std::sort(a,a+n-1,std::greater<int>() ); for(int i=0;i<k-1;i++) al-=a[i]; printf("%d",al); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 472 KB | Output is correct |
3 | Correct | 2 ms | 484 KB | Output is correct |
4 | Correct | 2 ms | 572 KB | Output is correct |
5 | Correct | 2 ms | 812 KB | Output is correct |
6 | Correct | 2 ms | 812 KB | Output is correct |
7 | Correct | 2 ms | 812 KB | Output is correct |
8 | Correct | 2 ms | 812 KB | Output is correct |
9 | Correct | 2 ms | 812 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 472 KB | Output is correct |
3 | Correct | 2 ms | 484 KB | Output is correct |
4 | Correct | 2 ms | 572 KB | Output is correct |
5 | Correct | 2 ms | 812 KB | Output is correct |
6 | Correct | 2 ms | 812 KB | Output is correct |
7 | Correct | 2 ms | 812 KB | Output is correct |
8 | Correct | 2 ms | 812 KB | Output is correct |
9 | Correct | 2 ms | 812 KB | Output is correct |
10 | Correct | 3 ms | 812 KB | Output is correct |
11 | Correct | 3 ms | 812 KB | Output is correct |
12 | Correct | 3 ms | 852 KB | Output is correct |
13 | Correct | 3 ms | 880 KB | Output is correct |
14 | Correct | 3 ms | 928 KB | Output is correct |
15 | Correct | 4 ms | 956 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 472 KB | Output is correct |
3 | Correct | 2 ms | 484 KB | Output is correct |
4 | Correct | 2 ms | 572 KB | Output is correct |
5 | Correct | 2 ms | 812 KB | Output is correct |
6 | Correct | 2 ms | 812 KB | Output is correct |
7 | Correct | 2 ms | 812 KB | Output is correct |
8 | Correct | 2 ms | 812 KB | Output is correct |
9 | Correct | 2 ms | 812 KB | Output is correct |
10 | Correct | 3 ms | 812 KB | Output is correct |
11 | Correct | 3 ms | 812 KB | Output is correct |
12 | Correct | 3 ms | 852 KB | Output is correct |
13 | Correct | 3 ms | 880 KB | Output is correct |
14 | Correct | 3 ms | 928 KB | Output is correct |
15 | Correct | 4 ms | 956 KB | Output is correct |
16 | Correct | 28 ms | 2656 KB | Output is correct |
17 | Correct | 30 ms | 3636 KB | Output is correct |
18 | Correct | 34 ms | 4644 KB | Output is correct |
19 | Correct | 36 ms | 5728 KB | Output is correct |
20 | Correct | 29 ms | 6548 KB | Output is correct |
21 | Correct | 27 ms | 7564 KB | Output is correct |
22 | Correct | 27 ms | 8576 KB | Output is correct |
23 | Correct | 26 ms | 9440 KB | Output is correct |
24 | Correct | 28 ms | 10404 KB | Output is correct |