# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
335636 | Joshc | Stove (JOI18_stove) | C++11 | 25 ms | 1768 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 <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n, k, x, y;
scanf("%d%d", &n, &k);
vector<int> v;
for (int i=0; i<n; i++) {
scanf("%d", &y);
if (i) v.push_back(y-x-1);
x = y;
}
int ans = n;
sort(v.begin(), v.end());
for (int i=0; i<n-k; i++) ans += v[i];
printf("%d\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... |