# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
114156 |
2019-05-30T20:40:38 Z |
Tadiorn |
Stove (JOI18_stove) |
C++14 |
|
59 ms |
1960 KB |
#include <bits/stdc++.h>
using namespace std;
priority_queue<int, vector<int>, greater<int> > pq;
int main()
{
int n, k;
cin >> n >> k;
int prev;
cin >> prev;
for(int i = 0; i < n - 1; i++)
{
int t;
cin >> t;
pq.push(t - prev);
prev = t;
}
int rez = n;
for(int i = 0; i < n - k; i++)
{
rez += pq.top() - 1; pq.pop();
}
cout << rez << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
3 ms |
384 KB |
Output is correct |
14 |
Correct |
3 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
3 ms |
384 KB |
Output is correct |
14 |
Correct |
3 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
384 KB |
Output is correct |
16 |
Correct |
59 ms |
1960 KB |
Output is correct |
17 |
Correct |
56 ms |
1908 KB |
Output is correct |
18 |
Correct |
57 ms |
1908 KB |
Output is correct |
19 |
Correct |
55 ms |
1880 KB |
Output is correct |
20 |
Correct |
53 ms |
1908 KB |
Output is correct |
21 |
Correct |
48 ms |
1908 KB |
Output is correct |
22 |
Correct |
47 ms |
1908 KB |
Output is correct |
23 |
Correct |
45 ms |
1908 KB |
Output is correct |
24 |
Correct |
46 ms |
1908 KB |
Output is correct |