# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
421934 |
2021-06-09T13:57:18 Z |
Gabp |
Stove (JOI18_stove) |
C++17 |
|
1 ms |
204 KB |
#include<bits/stdc++.h>
using namespace std;
int main() {
int n,k; cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
priority_queue<int> pq;
for (int i = 0; i < n - 1; i++) {
pq.push(max(0, a[i + 1] - 1 - a[i]));
}
int total = a[n - 1] - a[0] + 1;
while (!pq.empty() && k > 0) {
auto i = pq.top(); pq.pop();
total -= i;
k--;
}
cout << total;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |