#include <bits/stdc++.h>
#include "ricehub.h"
#define sz(s) (int)s.size()
using namespace std;
#define ll long long
int besthub(int n, int l, int a[], ll b){
vector <ll> v;
ll ans = 0;
for(int i = 0; i < n; i++){
v.clear();
ll b1 = b, x = 0;
for(int j = 0; j < n; j++){
if(a[i] != a[j]){
v.push_back(abs(a[i]-a[j]));
}
else x++;
}
if(sz(v) > 0){
sort(v.begin(),v.end());
for(auto j : v){
if(j > b1) break;
b1 -= j;
x++;
}
}
ans = max(ans,x);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 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 |
# |
결과 |
실행 시간 |
메모리 |
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 |
400 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 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 |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
2 ms |
448 KB |
Output is correct |
22 |
Correct |
2 ms |
348 KB |
Output is correct |
23 |
Correct |
4 ms |
348 KB |
Output is correct |
24 |
Correct |
4 ms |
452 KB |
Output is correct |
25 |
Correct |
4 ms |
348 KB |
Output is correct |
26 |
Correct |
4 ms |
348 KB |
Output is correct |
27 |
Correct |
3 ms |
348 KB |
Output is correct |
28 |
Correct |
6 ms |
456 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
16 ms |
344 KB |
Output is correct |
4 |
Correct |
15 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
344 KB |
Output is correct |
6 |
Correct |
3 ms |
348 KB |
Output is correct |
7 |
Correct |
8 ms |
460 KB |
Output is correct |
8 |
Correct |
8 ms |
348 KB |
Output is correct |
9 |
Correct |
4 ms |
348 KB |
Output is correct |
10 |
Correct |
4 ms |
348 KB |
Output is correct |
11 |
Correct |
10 ms |
460 KB |
Output is correct |
12 |
Correct |
10 ms |
464 KB |
Output is correct |
13 |
Correct |
16 ms |
464 KB |
Output is correct |
14 |
Correct |
16 ms |
464 KB |
Output is correct |
15 |
Correct |
4 ms |
452 KB |
Output is correct |
16 |
Correct |
4 ms |
348 KB |
Output is correct |
17 |
Correct |
9 ms |
460 KB |
Output is correct |
18 |
Correct |
10 ms |
348 KB |
Output is correct |
19 |
Correct |
16 ms |
456 KB |
Output is correct |
20 |
Correct |
16 ms |
348 KB |
Output is correct |
21 |
Correct |
265 ms |
344 KB |
Output is correct |
22 |
Correct |
239 ms |
344 KB |
Output is correct |
23 |
Correct |
563 ms |
580 KB |
Output is correct |
24 |
Correct |
617 ms |
600 KB |
Output is correct |
25 |
Correct |
484 ms |
584 KB |
Output is correct |
26 |
Correct |
526 ms |
600 KB |
Output is correct |
27 |
Correct |
469 ms |
600 KB |
Output is correct |
28 |
Correct |
489 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1035 ms |
860 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |