# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1106060 |
2024-10-29T05:41:11 Z |
lufychop |
Stove (JOI18_stove) |
C++14 |
|
1 ms |
336 KB |
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
int n,k,ans;
cin>>n>>k;
int t[n];
priority_queue<int> q;
for(int i=0;i<n;i++)
{
cin>>t[i];
}
for(int i=1;i<n;i++)
{
q.push(t[i]-t[i-1]-1);
}
ans=t[n-1]-t[0]+1;
while(k--)
{
ans=ans-q.top();
q.pop();
}
cout<<ans+1;
return 0;
}
/*
3 3
1
3
6
1 1
3 2
6 3
10 5
1
2
5
6
8
11
13
15
16
20
1 1 1->3
2 1
5 3 5->9
6 1
8 2
11 3 11->14
13 2
15 2 15->17
16 1
20 4 20->21
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |