# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
976737 | SeenSiravit | Stove (JOI18_stove) | C++14 | 19 ms | 1920 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 n,k;
int main(){
ios::sync_with_stdio(0),cin.tie(0);
cin>> n >> k;
priority_queue<int> pq;
int sum = 0;
int first_t;
cin>> first_t;
int dummy = first_t + 1;
for(int i=1;i<n;i++){
int t;
cin>> t;
pq.push(t - dummy);
dummy = t+1;
}
int reduce = 0;
while(!pq.empty() && k-->1){
reduce += pq.top();
pq.pop();
}
cout<< dummy - first_t - reduce;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |