Submission #1115276

#TimeUsernameProblemLanguageResultExecution timeMemory
1115276staszic_ojuzStove (JOI18_stove)C++17
100 / 100
26 ms2260 KiB
#include <iostream> #include <queue> using namespace std; const int MAXN = 100004; int n, l; int tablica[MAXN]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> l; for (int i = 0; n > i; i++) { cin >> tablica[i]; } int wynik = tablica[n - 1] - tablica[0] + 1; l--; priority_queue<int> kopiec; for (int i = 1; n > i; i++) { kopiec.push(tablica[i] - tablica[i - 1]); } while (l) { wynik -= kopiec.top(); wynik++; kopiec.pop(); l--; } cout << wynik; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...