Submission #1115202

#TimeUsernameProblemLanguageResultExecution timeMemory
1115202staszic_ojuzStove (JOI18_stove)C++17
100 / 100
36 ms1076 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int a, b; cin >> b; vector<int> odl; for(int i = 1; i < n; ++i) { cin >> a; odl.push_back(a-b-1); b = a; } sort(odl.begin(), odl.end()); int m = odl.size(); int odp = 0; for(int i = 0; i < m-k+1; ++i) odp += odl[i]; odp += n; cout << odp; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...