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 <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> decs;
int main() {
ios_base::sync_with_stdio(false);
int nbInvites, nbTours;
cin >> nbInvites >> nbTours;
int derTemps = 0;
for(int iInvite = 0;iInvite < nbInvites;iInvite++) {
int temps;
cin >> temps;
if(iInvite != 0)
decs.push_back(temps - derTemps - 1);
derTemps = temps;
}
sort(decs.begin(), decs.end());
int sommeDecs = nbInvites;
for(int iTour = 0;iTour < nbInvites - nbTours;iTour++) {
sommeDecs += decs[iTour];
}
cout << sommeDecs << endl;
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... |