Submission #889363

#TimeUsernameProblemLanguageResultExecution timeMemory
889363Hugo1729Stove (JOI18_stove)C++11
0 / 100
1 ms344 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...