| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 998310 | Roman70 | Stove (JOI18_stove) | C++17 | 44 ms | 2776 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
int n,k;
cin >> n >> k;
ll a[n];
for(int i = 0;i<n;i++){
cin >> a[i];
}
k--;
ll ans = n;
priority_queue<int>pq;
for(int i = 1;i<n;i++){
pq.push(a[i] - a[i-1] - 1);
}
while(pq.size() && k){
k--;
pq.pop();
}
while(pq.size()){
ans += pq.top();
pq.pop();
}
cout<<ans;
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... | ||||
