| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1328435 | repmann | Stove (JOI18_stove) | C++20 | 17 ms | 1400 KiB |
#include <bits/stdc++.h>
using namespace std;
int N, K;
int T[100001];
int main()
{
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> N >> K;
for(int i = 1; i <= N; i++) cin >> T[i];
priority_queue <int> H;
for(int i = 2; i <= N; i++) H.push(T[i] - T[i - 1] - 1);
int length = T[N] + 1 - T[1];
while(H.size() && (K > 1)) {length -= H.top(); H.pop(); K--;}
cout << length << '\n';
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... | ||||
