| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1287750 | North1304 | Stove (JOI18_stove) | C++20 | 14 ms | 1076 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int n,k;
cin >> n >> k;
vector<int> vec;
int last;
cin >> last;
for (int i=1;i<n;i++) {
int now;
cin >> now;
vec.push_back(now - last - 1);
last = now;
}
sort(vec.begin(), vec.end());
int ans = n;
for (int i=0;i<n-k;i++) ans += vec[i];
cout << ans;
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... | ||||
