| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1356299 | cnam9 | Stove (JOI18_stove) | C++20 | 10 ms | 824 KiB |
#include <iostream>
#include <algorithm>
using namespace std;
constexpr int N = 1e5 + 5;
int a[N];
signed main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
// freopen("input.txt", "r", stdin);
int n, k;
cin >> n >> k;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int res = a[n - 1] - a[0] + 1;
for (int i = n - 1; i; i--) {
a[i] -= a[i - 1];
}
nth_element(a + 1, a + k, a + n, greater<int>{});
for (int i = 1; i < k; i++) {
res -= a[i] - 1;
}
cout << res;
return 0;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
