| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1250582 | LaMatematica14 | Stove (JOI18_stove) | C++20 | 12 ms | 1096 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
int N, K; cin >> N >> K;
vector<long long> diff(N-1);
long long t; cin >> t;
for (int i = 0; i < N-1; i++) {
long long a; cin >> a;
diff[i] = a-t-1;
t = a;
}
sort(diff.begin(), diff.end());
long long tot = N;
for (int i = 0; i < N-K; i++) tot += diff[i];
cout << tot << "\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... | ||||
