| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 637006 | bonk | Stove (JOI18_stove) | C++14 | 20 ms | 3260 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;
using ll = long long;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, k; cin >> n >> k;
vector<ll>v(n), diff;
for(int i = 0; i < n; i++) cin >> v[i];
for(int i = 1; i < n; i++) diff.push_back(v[i] - v[i - 1] - 1);
sort(diff.begin(), diff.end());
ll ans = n;
for(int i = 0; i < n - k; i++) ans += diff[i];
cout << ans << '\n';
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... | ||||
