# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
303364 | vipghn2003 | Stove (JOI18_stove) | C++14 | 1 ms | 384 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 int long long
using namespace std;
main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n,k;
cin>>n>>k;
k--;
vector<int>a(n);
priority_queue<int>pq;
for(int i=0;i<n;i++)
{
cin>>a[i];
if(i) pq.push(a[i]-1-a[i-1]);
}
int res=a[n-1];
while(k--)
{
res-=pq.top();
pq.pop();
}
cout<<res;
}
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... |