Submission #889363

# Submission time Handle Problem Language Result Execution time Memory
889363 2023-12-19T13:38:04 Z Hugo1729 Stove (JOI18_stove) C++11
0 / 100
1 ms 344 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main() {
    int n,k; cin >> n >> k;

    ll ans=k;
    priority_queue<ll> p;
    int last; cin >> last;
    for(int i=1;i<n;i++) {
        int t; cin >> t;

        p.push(t-last-1);
        last=t;
    }

    int sus=n-k;
    while(sus--){
        ans+= p.top();
        p.pop();
    }

    cout << ans;


    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -