# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
586716 |
2022-06-30T14:54:04 Z |
Vanilla |
Stove (JOI18_stove) |
C++17 |
|
42 ms |
1876 KB |
#include <bits/stdc++.h>
using namespace std;typedef long long p;int main(){int n,k;cin>>n>>k;vector<p>a(n);vector<p>x(n-1);for(int i=0;i<n;i++){cin>>a[i];if(i!= 0)x[i-1]=a[i]-a[i-1]-1;}p rs=a[n-1]-a[0]+1;sort(x.begin(),x.end(),greater<p>());for(int i=0;i<k-1;i++){rs-=x[i];}cout<<rs<<"\n";return 0;}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 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 |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 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 |
2 ms |
340 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
2 ms |
340 KB |
Output is correct |
13 |
Correct |
2 ms |
340 KB |
Output is correct |
14 |
Correct |
2 ms |
344 KB |
Output is correct |
15 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 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 |
2 ms |
340 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
2 ms |
340 KB |
Output is correct |
13 |
Correct |
2 ms |
340 KB |
Output is correct |
14 |
Correct |
2 ms |
344 KB |
Output is correct |
15 |
Correct |
2 ms |
340 KB |
Output is correct |
16 |
Correct |
41 ms |
1748 KB |
Output is correct |
17 |
Correct |
42 ms |
1876 KB |
Output is correct |
18 |
Correct |
41 ms |
1876 KB |
Output is correct |
19 |
Correct |
41 ms |
1876 KB |
Output is correct |
20 |
Correct |
41 ms |
1748 KB |
Output is correct |
21 |
Correct |
42 ms |
1876 KB |
Output is correct |
22 |
Correct |
41 ms |
1748 KB |
Output is correct |
23 |
Correct |
41 ms |
1876 KB |
Output is correct |
24 |
Correct |
41 ms |
1748 KB |
Output is correct |