| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1324389 | riafhasan2010 | Stove (JOI18_stove) | C++17 | 14 ms | 956 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, k; cin >> n >> k;
ll ans = n, last = 0;
vector<int> t;
for (int i = 0; i < n; i++) {
int x; cin >> x;
if (i) t.push_back(x - last - 1);
last = x;
}
sort(t.begin(), t.end());
for (int i = 0; i < n - k; i++) ans += t[i];
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... | ||||
