#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int besthub(int n, int m, int a[], ll k)
{
ll ans = 0;
for(int i = 0; i < n; i++){
vector<int> v; v.clear();
for(int j = 0; j < n; j++)
v.push_back(abs(a[i]-a[j]));
sort(v.begin(), v.end());
for(int i = 1; i < n; i++) v[i]+=v[i-1];
int pos = upper_bound(v.begin(), v.end(), k)-v.begin();
if(ans<pos)ans=pos;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
5 ms |
204 KB |
Output is correct |
22 |
Correct |
5 ms |
204 KB |
Output is correct |
23 |
Correct |
7 ms |
300 KB |
Output is correct |
24 |
Correct |
7 ms |
204 KB |
Output is correct |
25 |
Correct |
7 ms |
204 KB |
Output is correct |
26 |
Correct |
7 ms |
204 KB |
Output is correct |
27 |
Correct |
7 ms |
300 KB |
Output is correct |
28 |
Correct |
9 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
2 ms |
204 KB |
Output is correct |
3 |
Correct |
22 ms |
288 KB |
Output is correct |
4 |
Correct |
22 ms |
312 KB |
Output is correct |
5 |
Correct |
5 ms |
304 KB |
Output is correct |
6 |
Correct |
6 ms |
204 KB |
Output is correct |
7 |
Correct |
18 ms |
204 KB |
Output is correct |
8 |
Correct |
19 ms |
204 KB |
Output is correct |
9 |
Correct |
10 ms |
204 KB |
Output is correct |
10 |
Correct |
10 ms |
296 KB |
Output is correct |
11 |
Correct |
18 ms |
312 KB |
Output is correct |
12 |
Correct |
18 ms |
308 KB |
Output is correct |
13 |
Correct |
28 ms |
204 KB |
Output is correct |
14 |
Correct |
28 ms |
204 KB |
Output is correct |
15 |
Correct |
8 ms |
204 KB |
Output is correct |
16 |
Correct |
7 ms |
204 KB |
Output is correct |
17 |
Correct |
17 ms |
204 KB |
Output is correct |
18 |
Correct |
17 ms |
312 KB |
Output is correct |
19 |
Correct |
27 ms |
308 KB |
Output is correct |
20 |
Correct |
27 ms |
308 KB |
Output is correct |
21 |
Correct |
540 ms |
356 KB |
Output is correct |
22 |
Correct |
537 ms |
448 KB |
Output is correct |
23 |
Correct |
926 ms |
388 KB |
Output is correct |
24 |
Correct |
949 ms |
384 KB |
Output is correct |
25 |
Correct |
906 ms |
396 KB |
Output is correct |
26 |
Correct |
849 ms |
396 KB |
Output is correct |
27 |
Correct |
776 ms |
432 KB |
Output is correct |
28 |
Correct |
778 ms |
396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
848 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |