# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
731340 |
2023-04-27T10:33:32 Z |
peteza |
Stove (JOI18_stove) |
C++14 |
|
57 ms |
1796 KB |
#include <bits/stdc++.h>
using namespace std;
int n, k, x, y, sum = 0;
priority_queue<int, vector<int>, greater<int>> pq;
int main() {
cin >> n >> k;
sum = n;
cin >> x;
for(int i=1;i<n;i++) {
cin >> y;
pq.push(y-x-1);
x = y;
}
while(n > k) {
n--;
sum += pq.top();
pq.pop();
}
cout << sum;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
220 KB |
Output is correct |
4 |
Correct |
0 ms |
304 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
220 KB |
Output is correct |
4 |
Correct |
0 ms |
304 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
316 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
2 ms |
316 KB |
Output is correct |
13 |
Correct |
2 ms |
312 KB |
Output is correct |
14 |
Correct |
2 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
240 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
220 KB |
Output is correct |
4 |
Correct |
0 ms |
304 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
316 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
2 ms |
316 KB |
Output is correct |
13 |
Correct |
2 ms |
312 KB |
Output is correct |
14 |
Correct |
2 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
240 KB |
Output is correct |
16 |
Correct |
49 ms |
1684 KB |
Output is correct |
17 |
Correct |
54 ms |
1792 KB |
Output is correct |
18 |
Correct |
57 ms |
1780 KB |
Output is correct |
19 |
Correct |
50 ms |
1736 KB |
Output is correct |
20 |
Correct |
47 ms |
1752 KB |
Output is correct |
21 |
Correct |
39 ms |
1796 KB |
Output is correct |
22 |
Correct |
39 ms |
1788 KB |
Output is correct |
23 |
Correct |
39 ms |
1708 KB |
Output is correct |
24 |
Correct |
39 ms |
1744 KB |
Output is correct |