# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
492829 |
2021-12-09T06:49:08 Z |
watoKE |
Stove (JOI18_stove) |
C++17 |
|
0 ms |
204 KB |
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
int n,m,a,b,c,cnt,g,f,d,e,cvp,k;
int dizi[100005];
int fark[100005];
int main()
{
cin>>n>>k;
for (int i=0;i<n;i++)
cin>>dizi[i];
for (int i=0;i<n-1;i++)
fark[i]=dizi[i+1]-dizi[i]-1;
sort(fark,fark+n-1);
reverse(fark,fark+n-1);
cvp=dizi[n-1];
for (int i=0;i<k-1;i++)
cvp-=fark[i];
cout<<cvp;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |