#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 1;
priority_queue<long long, vector<long long>, greater<long long>> q;
int besthub(int R, int L, int X[], long long B)
{
for(int i=0;i<R;i++) {
q.push(abs(X[i] - X[(R-1)/2]));
}
long long ans = 0 , cou = 0;
while (!q.empty()) {
long long t = q.top(); q.pop();
cou += t;
if (cou>B) break;
ans++;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
308 KB |
Output is correct |
2 |
Incorrect |
1 ms |
308 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
316 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 |
1 ms |
308 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
312 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
308 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 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 |
312 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
312 KB |
Output is correct |
10 |
Correct |
1 ms |
308 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
888 KB |
Output is correct |
2 |
Correct |
3 ms |
820 KB |
Output is correct |
3 |
Correct |
22 ms |
2644 KB |
Output is correct |
4 |
Correct |
22 ms |
2680 KB |
Output is correct |
5 |
Correct |
6 ms |
1488 KB |
Output is correct |
6 |
Correct |
5 ms |
1472 KB |
Output is correct |
7 |
Correct |
18 ms |
2528 KB |
Output is correct |
8 |
Correct |
22 ms |
2652 KB |
Output is correct |
9 |
Correct |
6 ms |
1360 KB |
Output is correct |
10 |
Correct |
7 ms |
1344 KB |
Output is correct |
11 |
Correct |
23 ms |
2624 KB |
Output is correct |
12 |
Correct |
28 ms |
2676 KB |
Output is correct |
13 |
Incorrect |
7 ms |
1488 KB |
Output isn't correct |
14 |
Halted |
0 ms |
0 KB |
- |