| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1331137 | _apknxn | Stove (JOI18_stove) | C++20 | 64 ms | 1544 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
vector<ll> t;
priority_queue<ll> b;
int main()
{
ll n, k, tt = 0, st = 0, ed = 0, f, a;
cin >> n >> k;
for (int i = 0; i < n; i++)
{
cin >> a;
if (ed == 0)
{
ed = a;
f = a;
}
if (a != ed)
b.push(a - ed - 1);
ed = a;
}
st = ed - f + 1;
for (int i = 1; i < k; i++)
{
st -= b.top();
b.pop();
}
cout << st << "\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... | ||||
