Submission #114156

#TimeUsernameProblemLanguageResultExecution timeMemory
114156TadiornStove (JOI18_stove)C++14
100 / 100
59 ms1960 KiB
#include <bits/stdc++.h> using namespace std; priority_queue<int, vector<int>, greater<int> > pq; int main() { int n, k; cin >> n >> k; int prev; cin >> prev; for(int i = 0; i < n - 1; i++) { int t; cin >> t; pq.push(t - prev); prev = t; } int rez = n; for(int i = 0; i < n - k; i++) { rez += pq.top() - 1; pq.pop(); } cout << rez << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...