| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 653039 | Juan | Stove (JOI18_stove) | C++14 | 54 ms | 2296 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 maxn = 1e5 + 5;
int v[maxn];
priority_queue<int, vector<int>, greater<int>> near;
int main(){
int n, k; cin >> n >> k;
for(int i = 0; i < n; i++) cin >> v[i];
sort(v, v+n);
for(int i = 1; i < n; i++) near.push(v[i]+1 - v[i-1]);
int ans = n;
k = n-k;
while(k--) ans += near.top()-2, near.pop();
cout << ans << '\n';
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
