| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 978260 | YABYAB | Stove (JOI18_stove) | C++17 | 46 ms | 2516 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>
using namespace std;
int main() {
int n,k;
cin >> n >> k;
int ll[n];
for(int i = 0; i < n; i++){
cin >> ll[i];
}
priority_queue<int> pq;
for(int i = 0; i < n-1; i++){
pq.push(ll[i+1]-ll[i]-1);
}
k--;
int ans = ll[n-1] - ll[0] +1;
while(k>0 && !pq.empty() && pq.top() > 0){
ans-=pq.top();
pq.pop();
k--;
}
cout << ans;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
