# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1009992 |
2024-06-28T08:53:24 Z |
Jovica |
Stove (JOI18_stove) |
C++14 |
|
34 ms |
3148 KB |
#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
int main()
{
long long n,k;
cin>>n>>k;
priority_queue<long long> q;
for (long long i=0;i<n;i++)
{
long long a;
cin>>a;
v.push_back(a);
if (i>0) q.push(-(v[i]-v[i-1]-1));
}
long long odg=n;
for (long long i=n;i>k;i--)
{
long long x = abs(q.top());
q.pop();
//cout<< "dodava "<<x<<endl;
odg+=x;
}
cout<<odg<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
2 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
2 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
444 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
2 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
2 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
444 KB |
Output is correct |
16 |
Correct |
34 ms |
3004 KB |
Output is correct |
17 |
Correct |
30 ms |
3024 KB |
Output is correct |
18 |
Correct |
34 ms |
3024 KB |
Output is correct |
19 |
Correct |
32 ms |
3048 KB |
Output is correct |
20 |
Correct |
32 ms |
2936 KB |
Output is correct |
21 |
Correct |
26 ms |
3128 KB |
Output is correct |
22 |
Correct |
25 ms |
3148 KB |
Output is correct |
23 |
Correct |
25 ms |
3020 KB |
Output is correct |
24 |
Correct |
25 ms |
3024 KB |
Output is correct |