# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
134172 | Boxworld | Stove (JOI18_stove) | C++14 | 28 ms | 1784 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int d[100100];
int main(){
int n,k,l,x,ans=0,tmp=0;
scanf("%d%d%d",&n,&k,&l);
for (int i=0;i<n-1;i++){
scanf("%d",&x);
d[tmp]=x-l-1;
if (d[tmp]!=0)tmp++;
l=x;
}
sort(d,d+tmp);
for (int i=0;i<max(0,tmp-k+1);i++)ans+=d[i];
printf("%d\n",n+ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |