| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 939138 | vjudge1 | Stove (JOI18_stove) | C++17 | 18 ms | 2272 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;
const int N = (int)1e5+7;
const long long INF = (long long)1e18+7;
int n, k, a[N];
vector<int> b;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n >> k;
for(int i = 1; i <= n; ++i) {
cin >> a[i];
}
int ans = a[n]-a[1];
for(int i = 2; i <= n; ++i) {
b.push_back(a[i]-a[i-1]);
}
k--;
sort(b.rbegin(), b.rend());
for(int i = 0; i < k; ++i) {
ans -= b[i];
}
cout << ans+k+1;
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... | ||||
