#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector <ll> arr;
ll RO(ll budget, ll cord) {
priority_queue <ll, vector <ll>, greater <ll> > pq;
for (ll x : arr) pq.push(abs(x-cord));
ll paks = 0, suma = 0;
while (!pq.empty() && suma <= budget) {
ll curr = pq.top();
pq.pop();
if (suma + curr <= budget) suma += curr, paks++;
else break;
}
return paks;
}
int besthub(int R, int L, int X[], ll B) {
for (ll i=0; i<R; i++) arr.push_back((ll)X[i]);
ll maxi = 0;
for (ll i : arr) {
maxi = max(maxi, RO(B, i));
}
return maxi;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
1 ms |
256 KB |
Output is correct |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Correct |
0 ms |
256 KB |
Output is correct |
10 |
Correct |
1 ms |
288 KB |
Output is correct |
11 |
Correct |
1 ms |
256 KB |
Output is correct |
12 |
Correct |
0 ms |
256 KB |
Output is correct |
13 |
Correct |
1 ms |
256 KB |
Output is correct |
14 |
Correct |
1 ms |
256 KB |
Output is correct |
15 |
Correct |
1 ms |
256 KB |
Output is correct |
16 |
Correct |
1 ms |
256 KB |
Output is correct |
17 |
Correct |
1 ms |
256 KB |
Output is correct |
18 |
Correct |
1 ms |
256 KB |
Output is correct |
19 |
Correct |
1 ms |
256 KB |
Output is correct |
20 |
Correct |
1 ms |
256 KB |
Output is correct |
21 |
Correct |
5 ms |
384 KB |
Output is correct |
22 |
Correct |
5 ms |
384 KB |
Output is correct |
23 |
Correct |
14 ms |
384 KB |
Output is correct |
24 |
Correct |
14 ms |
384 KB |
Output is correct |
25 |
Correct |
14 ms |
384 KB |
Output is correct |
26 |
Correct |
14 ms |
384 KB |
Output is correct |
27 |
Correct |
9 ms |
384 KB |
Output is correct |
28 |
Correct |
10 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
360 KB |
Output is correct |
3 |
Correct |
57 ms |
388 KB |
Output is correct |
4 |
Correct |
53 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
384 KB |
Output is correct |
6 |
Correct |
4 ms |
384 KB |
Output is correct |
7 |
Correct |
22 ms |
384 KB |
Output is correct |
8 |
Correct |
17 ms |
384 KB |
Output is correct |
9 |
Correct |
7 ms |
384 KB |
Output is correct |
10 |
Correct |
8 ms |
384 KB |
Output is correct |
11 |
Correct |
17 ms |
404 KB |
Output is correct |
12 |
Correct |
15 ms |
384 KB |
Output is correct |
13 |
Correct |
81 ms |
504 KB |
Output is correct |
14 |
Correct |
70 ms |
392 KB |
Output is correct |
15 |
Correct |
13 ms |
384 KB |
Output is correct |
16 |
Correct |
10 ms |
384 KB |
Output is correct |
17 |
Correct |
58 ms |
384 KB |
Output is correct |
18 |
Correct |
45 ms |
288 KB |
Output is correct |
19 |
Correct |
69 ms |
396 KB |
Output is correct |
20 |
Correct |
66 ms |
388 KB |
Output is correct |
21 |
Correct |
445 ms |
512 KB |
Output is correct |
22 |
Correct |
416 ms |
512 KB |
Output is correct |
23 |
Execution timed out |
1087 ms |
512 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1073 ms |
1128 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |