#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
int besthub(int R, int L, int X[], long long B)
{
int ans = 0;
for(int i = 0; i < R; ++i){
priority_queue<int> q;
for(int j = 0; j < R; ++j){
q.push(-abs(X[i] - X[j]));
}
ll cost = 0;
int actual = 0;
while(!q.empty() && cost + (-q.top()) <= B){
++actual;
cost += -q.top();
q.pop();
}
ans = max(ans, actual);
}
return ans;
}
# |
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 |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 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 |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 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 |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
2 ms |
212 KB |
Output is correct |
22 |
Correct |
2 ms |
212 KB |
Output is correct |
23 |
Correct |
10 ms |
316 KB |
Output is correct |
24 |
Correct |
10 ms |
212 KB |
Output is correct |
25 |
Correct |
10 ms |
308 KB |
Output is correct |
26 |
Correct |
10 ms |
316 KB |
Output is correct |
27 |
Correct |
6 ms |
212 KB |
Output is correct |
28 |
Correct |
6 ms |
308 KB |
Output is correct |
# |
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 |
41 ms |
332 KB |
Output is correct |
4 |
Correct |
38 ms |
304 KB |
Output is correct |
5 |
Correct |
2 ms |
212 KB |
Output is correct |
6 |
Correct |
2 ms |
312 KB |
Output is correct |
7 |
Correct |
7 ms |
212 KB |
Output is correct |
8 |
Correct |
7 ms |
328 KB |
Output is correct |
9 |
Correct |
4 ms |
212 KB |
Output is correct |
10 |
Correct |
4 ms |
212 KB |
Output is correct |
11 |
Correct |
9 ms |
328 KB |
Output is correct |
12 |
Correct |
9 ms |
212 KB |
Output is correct |
13 |
Correct |
55 ms |
212 KB |
Output is correct |
14 |
Correct |
50 ms |
212 KB |
Output is correct |
15 |
Correct |
6 ms |
440 KB |
Output is correct |
16 |
Correct |
6 ms |
212 KB |
Output is correct |
17 |
Correct |
33 ms |
340 KB |
Output is correct |
18 |
Correct |
30 ms |
308 KB |
Output is correct |
19 |
Correct |
54 ms |
320 KB |
Output is correct |
20 |
Correct |
49 ms |
212 KB |
Output is correct |
21 |
Correct |
163 ms |
392 KB |
Output is correct |
22 |
Correct |
163 ms |
340 KB |
Output is correct |
23 |
Execution timed out |
1092 ms |
352 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1070 ms |
636 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |