#include <bits/stdc++.h>
#define ll long long
//#define int ll
using namespace std;
ifstream f ("test.in");
ofstream g ("test.out");
priority_queue < int > q;
int main()
{
int n,k;
cin>>n>>k;
vector < int > v(n+5);
for(int i=1;i<=n;++i)
{
cin>>v[i];
}
if(n == k)
{
cout<<n;
return 0;
}
for(int i=1;i<n;++i)
{ cout<<v[i+1]-v[i]-1<<'\n';
q.push( (v[i+1]-v[i]-1) );
}
int ans = v[n];
k--;
while(k--)
{
int x = q.top();
cout<<x<< '\n';
ans -=x;
q.pop();
}
cout<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |