| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 159978 | combi1k1 | Stove (JOI18_stove) | C++14 | 32 ms | 1316 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 = 1e5 + 1;
int n, k;
int t[N];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n >> k; --k;
priority_queue<int> pq;
for(int i = 1 ; i <= n ; ++i) {
cin >> t[i];
if (i > 1)
pq.push(t[i] - t[i - 1] - 1);
}
int ans = t[n] - t[1] + 1;
for(; k && pq.size() ; --k, pq.pop())
ans -= pq.top();
cout << ans << endl;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
