| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1314909 | hoax | Stove (JOI18_stove) | C++20 | 43 ms | 1424 KiB |
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
int main(){
int n; cin >> n;
int k; cin >> k;
vector<int> arr(n);
for(int i=0; i<n; ++i){cin >> arr[i];}
sort(all(arr));
int tot = arr[n-1]-arr[0]+1;
vector<int> b;
for(int i=1; i<n; ++i){
b.push_back(arr[i]-arr[i-1]-1);
}
sort(all(b));
int cnt = 1;
while(!b.empty() && cnt < k){
tot -= b.back();
b.pop_back();
cnt += 1;
}
cout << tot << 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... | ||||
