| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1357305 | filipksel | Stove (JOI18_stove) | C++20 | 14 ms | 1472 KiB |
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n,k;
cin >> n >> k;
vector<int> v(n);
for(int i = 0; i < n; i++)
cin >> v[i];
int ans = v[n-1] - v[0] + 1;
priority_queue<int> Q;
for(int i = 1; i < n; i++)
Q.push(v[i] - 1 - v[i-1]);
int Left = k - 1; //-1 because we alreadu used the first match
while(Left--)
{
int x = Q.top();
Q.pop();
ans -= x;
}
cout << ans << "\n";
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
