# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
70169 | 3zp | Stove (JOI18_stove) | C++14 | 79 ms | 10536 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 n, k, t[100009];
vector<int> v;
main(){
cin >> n >> k >> t[0];
for(int i = 1; i < n; i++){
cin >> t[i];
v.push_back(t[i] - t[i-1] - 1);
}
int ans = n;
sort(v.begin(), v.end());
for(int i = 0; i < n - k; i++)
ans += v[i];
cout<< ans << endl;
}
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... |