# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
651332 |
2022-10-18T12:38:20 Z |
pauloamed |
Stove (JOI18_stove) |
C++17 |
|
0 ms |
212 KB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
int32_t main(){
int n, k; cin >> n >> k;
vector<int> v(n);
for(auto &x : v) cin >> x;
priority_queue<int> pq;
for(int i = 1; i < n; ++i){
pq.push(v[i] - v[i - 1] - 1);
}
int ans = v.back();
for(int i = 1; i < k; ++i){
ans -= pq.top();
pq.pop();
}
cout << ans << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |