# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
548835 |
2022-04-14T13:01:16 Z |
Jokubas |
Stove (JOI18_stove) |
C++14 |
|
64 ms |
2264 KB |
#include <iostream>
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
int main()
{
int N, K;
cin>>N>>K;
int kada[N];
for(int i = 0; i<N; i++)
{
cin>>kada[i];
}
priority_queue<int> q;
int praeitas = kada[0];
for(int i = 1; i<N; i++)
{
q.push(kada[i] - praeitas - 1);
praeitas = kada[i];
}
int ats = kada[N-1] - kada[0] + 1;
for(int i = 0; i<K-1; i++)
{
ats-=q.top();
q.pop();
}
cout<<ats;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
296 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
340 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 |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
296 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
340 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 |
340 KB |
Output is correct |
11 |
Correct |
2 ms |
312 KB |
Output is correct |
12 |
Correct |
2 ms |
340 KB |
Output is correct |
13 |
Correct |
2 ms |
340 KB |
Output is correct |
14 |
Correct |
2 ms |
308 KB |
Output is correct |
15 |
Correct |
2 ms |
312 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
296 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
340 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 |
340 KB |
Output is correct |
11 |
Correct |
2 ms |
312 KB |
Output is correct |
12 |
Correct |
2 ms |
340 KB |
Output is correct |
13 |
Correct |
2 ms |
340 KB |
Output is correct |
14 |
Correct |
2 ms |
308 KB |
Output is correct |
15 |
Correct |
2 ms |
312 KB |
Output is correct |
16 |
Correct |
39 ms |
2220 KB |
Output is correct |
17 |
Correct |
38 ms |
2264 KB |
Output is correct |
18 |
Correct |
42 ms |
2248 KB |
Output is correct |
19 |
Correct |
39 ms |
2200 KB |
Output is correct |
20 |
Correct |
51 ms |
2192 KB |
Output is correct |
21 |
Correct |
64 ms |
2216 KB |
Output is correct |
22 |
Correct |
49 ms |
2192 KB |
Output is correct |
23 |
Correct |
51 ms |
2248 KB |
Output is correct |
24 |
Correct |
51 ms |
2252 KB |
Output is correct |