# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
593274 |
2022-07-10T18:27:31 Z |
daisy2 |
Stove (JOI18_stove) |
C++14 |
|
44 ms |
2028 KB |
#include<iostream>
#include<algorithm>
using namespace std;
long long n,k,in[100005],pr,a,r;
int main()
{
cin>>n>>k;k--;
cin>>pr;
r-=(pr-1);
for(int i=1;i<n;i++)
{
cin>>a;
in[i-1]=a-pr-1;
pr=a;
}
r+=pr;
sort(in,in+n);
for(int i=n-1;i>=n-k;i--)
{
r-=in[i];
}
cout<<r<<endl;
}
# |
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 |
1 ms |
308 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 |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 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 |
1 ms |
308 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 |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
324 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
2 ms |
348 KB |
Output is correct |
13 |
Correct |
2 ms |
340 KB |
Output is correct |
14 |
Correct |
2 ms |
328 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 |
1 ms |
308 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 |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
324 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
2 ms |
348 KB |
Output is correct |
13 |
Correct |
2 ms |
340 KB |
Output is correct |
14 |
Correct |
2 ms |
328 KB |
Output is correct |
15 |
Correct |
2 ms |
340 KB |
Output is correct |
16 |
Correct |
44 ms |
1960 KB |
Output is correct |
17 |
Correct |
42 ms |
1996 KB |
Output is correct |
18 |
Correct |
43 ms |
2028 KB |
Output is correct |
19 |
Correct |
42 ms |
2020 KB |
Output is correct |
20 |
Correct |
44 ms |
1956 KB |
Output is correct |
21 |
Correct |
44 ms |
1964 KB |
Output is correct |
22 |
Correct |
42 ms |
2016 KB |
Output is correct |
23 |
Correct |
41 ms |
1988 KB |
Output is correct |
24 |
Correct |
43 ms |
1956 KB |
Output is correct |