# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
967650 |
2024-04-22T15:04:04 Z |
jadai007 |
Stove (JOI18_stove) |
C++17 |
|
1 ms |
456 KB |
#include<bits/stdc++.h>
using namespace std;
priority_queue<int> pq;
int n, k, T[100100], ans;
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
cin >> n >> k;
for(int i = 1; i<=n; ++i) cin >> T[i];
sort(T+1, T+1+n);
k--;
for(int i = 2; i<=n; ++i) pq.push(T[i] - T[i - 1] - 1);
ans = T[n] - T[1] + 1;
while(k--){
ans-=pq.top();
pq.top();
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
456 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
456 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
456 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |