#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;
int besthub(int n, int l, int x[], long long B) {
int ans = 0;
for (int i = 0; i < n; i++) {
int co = 0, s = B;
vector<int> a;
for (int j = 0; j < n; j++) {
a.push_back(abs(x[i]-x[j]));
}
sort(a.rbegin(), a.rend());
while(!a.empty() && a.back() <= s) {
co++;
s -= a.back();
a.pop_back();
}
ans = max(ans, co);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 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 |
448 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 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 |
1 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 |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
600 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
448 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
3 ms |
348 KB |
Output is correct |
22 |
Correct |
2 ms |
344 KB |
Output is correct |
23 |
Correct |
6 ms |
452 KB |
Output is correct |
24 |
Correct |
4 ms |
348 KB |
Output is correct |
25 |
Correct |
4 ms |
452 KB |
Output is correct |
26 |
Correct |
4 ms |
452 KB |
Output is correct |
27 |
Correct |
3 ms |
448 KB |
Output is correct |
28 |
Correct |
4 ms |
452 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
12 ms |
348 KB |
Output is correct |
4 |
Correct |
13 ms |
344 KB |
Output is correct |
5 |
Correct |
2 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
8 ms |
468 KB |
Output is correct |
8 |
Correct |
8 ms |
460 KB |
Output is correct |
9 |
Correct |
4 ms |
344 KB |
Output is correct |
10 |
Correct |
4 ms |
344 KB |
Output is correct |
11 |
Correct |
10 ms |
344 KB |
Output is correct |
12 |
Correct |
10 ms |
344 KB |
Output is correct |
13 |
Correct |
17 ms |
460 KB |
Output is correct |
14 |
Correct |
17 ms |
344 KB |
Output is correct |
15 |
Correct |
5 ms |
348 KB |
Output is correct |
16 |
Correct |
5 ms |
600 KB |
Output is correct |
17 |
Correct |
11 ms |
464 KB |
Output is correct |
18 |
Correct |
12 ms |
464 KB |
Output is correct |
19 |
Correct |
17 ms |
460 KB |
Output is correct |
20 |
Correct |
17 ms |
344 KB |
Output is correct |
21 |
Correct |
296 ms |
592 KB |
Output is correct |
22 |
Correct |
313 ms |
348 KB |
Output is correct |
23 |
Correct |
657 ms |
344 KB |
Output is correct |
24 |
Correct |
570 ms |
344 KB |
Output is correct |
25 |
Correct |
568 ms |
592 KB |
Output is correct |
26 |
Correct |
603 ms |
536 KB |
Output is correct |
27 |
Correct |
424 ms |
344 KB |
Output is correct |
28 |
Correct |
442 ms |
536 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1094 ms |
880 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |