Submission #1015534

# Submission time Handle Problem Language Result Execution time Memory
1015534 2024-07-06T13:32:48 Z adkjt Stove (JOI18_stove) C++14
0 / 100
0 ms 344 KB
#include<bits/stdc++.h>
using namespace std;
priority_queue<int> pq;
int a[111111];
int main()
{
   int n,k;cin>>n>>k;
   for(int i=1;i<=n;i++)
    cin>>a[i];
   for(int i=2;i<=n;i++)
    pq.push(a[i]-a[i-1]-1);
   int ans=0;
   int cnt=n;
   while(cnt>k){
    ans+=pq.top();
    pq.pop();
    cnt--;
    }
    cout<<a[n]-ans+1<<'\n';
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -