# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
74054 |
2018-08-29T16:48:37 Z |
Bodo171 |
Stove (JOI18_stove) |
C++14 |
|
41 ms |
10384 KB |
#include <iostream>
#include <algorithm>
using namespace std;
const int nmax=100005;
int t[nmax],skip[nmax];
int n,k,i,ans;
int main()
{
ios_base::sync_with_stdio(false);
cin>>n>>k;
for(i=1;i<=n;i++)
{
cin>>t[i];
}
ans=t[n]-t[1]+1;
for(i=1;i<n;i++)
{
skip[i]=t[i+1]-t[i]-1;
}
sort(skip+1,skip+n);
for(i=n-1;i>=n-k+1;i--)
ans-=skip[i];
cout<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
396 KB |
Output is correct |
2 |
Correct |
4 ms |
508 KB |
Output is correct |
3 |
Correct |
3 ms |
508 KB |
Output is correct |
4 |
Correct |
3 ms |
624 KB |
Output is correct |
5 |
Correct |
4 ms |
676 KB |
Output is correct |
6 |
Correct |
4 ms |
676 KB |
Output is correct |
7 |
Correct |
4 ms |
676 KB |
Output is correct |
8 |
Correct |
3 ms |
676 KB |
Output is correct |
9 |
Correct |
4 ms |
676 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
396 KB |
Output is correct |
2 |
Correct |
4 ms |
508 KB |
Output is correct |
3 |
Correct |
3 ms |
508 KB |
Output is correct |
4 |
Correct |
3 ms |
624 KB |
Output is correct |
5 |
Correct |
4 ms |
676 KB |
Output is correct |
6 |
Correct |
4 ms |
676 KB |
Output is correct |
7 |
Correct |
4 ms |
676 KB |
Output is correct |
8 |
Correct |
3 ms |
676 KB |
Output is correct |
9 |
Correct |
4 ms |
676 KB |
Output is correct |
10 |
Correct |
5 ms |
676 KB |
Output is correct |
11 |
Correct |
5 ms |
676 KB |
Output is correct |
12 |
Correct |
3 ms |
832 KB |
Output is correct |
13 |
Correct |
4 ms |
832 KB |
Output is correct |
14 |
Correct |
3 ms |
872 KB |
Output is correct |
15 |
Correct |
3 ms |
960 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
396 KB |
Output is correct |
2 |
Correct |
4 ms |
508 KB |
Output is correct |
3 |
Correct |
3 ms |
508 KB |
Output is correct |
4 |
Correct |
3 ms |
624 KB |
Output is correct |
5 |
Correct |
4 ms |
676 KB |
Output is correct |
6 |
Correct |
4 ms |
676 KB |
Output is correct |
7 |
Correct |
4 ms |
676 KB |
Output is correct |
8 |
Correct |
3 ms |
676 KB |
Output is correct |
9 |
Correct |
4 ms |
676 KB |
Output is correct |
10 |
Correct |
5 ms |
676 KB |
Output is correct |
11 |
Correct |
5 ms |
676 KB |
Output is correct |
12 |
Correct |
3 ms |
832 KB |
Output is correct |
13 |
Correct |
4 ms |
832 KB |
Output is correct |
14 |
Correct |
3 ms |
872 KB |
Output is correct |
15 |
Correct |
3 ms |
960 KB |
Output is correct |
16 |
Correct |
33 ms |
2728 KB |
Output is correct |
17 |
Correct |
30 ms |
3732 KB |
Output is correct |
18 |
Correct |
30 ms |
4696 KB |
Output is correct |
19 |
Correct |
27 ms |
5564 KB |
Output is correct |
20 |
Correct |
34 ms |
6528 KB |
Output is correct |
21 |
Correct |
41 ms |
7492 KB |
Output is correct |
22 |
Correct |
30 ms |
8456 KB |
Output is correct |
23 |
Correct |
27 ms |
9420 KB |
Output is correct |
24 |
Correct |
26 ms |
10384 KB |
Output is correct |