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>
#define lint long long
#define pb push_back
#define mp make_pair
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, k;
cin >> n >> k;
vector<int> v;
for(int i = 0; i < n; i ++){
int temp;
cin >> temp;
v.pb(temp);
}
vector<int> vb;
for(int i = 1; i < n; i ++){
vb.pb(v[i]-v[i-1]-1);
}
sort(vb.begin(), vb.end());
for(auto i : vb){cout << i << " ";} cout << endl;
int time = n;
if(k >= n){cout << n;}
else{
for(int i = 0; i < n-k; i ++){
time+=vb[i];
}
cout << time;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |