Submission #162216

#TimeUsernameProblemLanguageResultExecution timeMemory
162216joylintpStove (JOI18_stove)C++17
100 / 100
26 ms2420 KiB
#include<bits/stdc++.h> #define int long long using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, k, t, tt; vector<int> v; cin >> n >> k >> t; for (int i = 1; i < n; i++) tt = t, cin >> t, v.push_back(t - tt - 1); sort(v.begin(), v.end()); int ans = 0; for (int i = 0; i < n - k; i++) ans += v[i]; cout << ans + n << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...