| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1242562 | hamase | Stove (JOI18_stove) | C++20 | 29 ms | 1864 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll N, K, t[100100], ant[100100], ans;
int main() {
cin >> N >> K;
if (N == 1) {
cout << 1 << endl;
return 0;
}
ans = N;
for (int i = 0; i < N; i++) cin >> t[i];
for (int i = 0; i < N-1; i++) {
ant[i] = t[i+1]-t[i]-1;
}
sort(ant, ant+N-1);
for (int i = 0; i < N-K; i++) {
ans += ant[i];
}
cout << ans << 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... | ||||
