#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define fs first
#define sc second
#define pb push_back
int besthub(int n, int l, int X[], long long b)
{
ll a[n],ans=0;
for(int i=0;i<n;i++)a[i]=X[i];
for(int i=0;i<n;i++){
vector<ll> v;
for(int j=0;j<n;j++)v.pb(abs(a[i]-a[j]));
sort(v.begin(),v.end());
ll s=0,c=0;
for(int i=0;i<n;i++){
s+=v[i];
if(s>b)break;
c++;
}
ans=max(ans,c);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 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 |
348 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 |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
2 ms |
344 KB |
Output is correct |
22 |
Correct |
2 ms |
456 KB |
Output is correct |
23 |
Correct |
4 ms |
456 KB |
Output is correct |
24 |
Correct |
4 ms |
348 KB |
Output is correct |
25 |
Correct |
4 ms |
348 KB |
Output is correct |
26 |
Correct |
4 ms |
348 KB |
Output is correct |
27 |
Correct |
4 ms |
348 KB |
Output is correct |
28 |
Correct |
4 ms |
452 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
448 KB |
Output is correct |
3 |
Correct |
16 ms |
476 KB |
Output is correct |
4 |
Correct |
14 ms |
472 KB |
Output is correct |
5 |
Correct |
2 ms |
464 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
8 ms |
348 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 |
476 KB |
Output is correct |
12 |
Correct |
10 ms |
348 KB |
Output is correct |
13 |
Correct |
16 ms |
348 KB |
Output is correct |
14 |
Correct |
16 ms |
348 KB |
Output is correct |
15 |
Correct |
4 ms |
348 KB |
Output is correct |
16 |
Correct |
6 ms |
348 KB |
Output is correct |
17 |
Correct |
10 ms |
348 KB |
Output is correct |
18 |
Correct |
14 ms |
348 KB |
Output is correct |
19 |
Correct |
16 ms |
348 KB |
Output is correct |
20 |
Correct |
16 ms |
344 KB |
Output is correct |
21 |
Correct |
329 ms |
604 KB |
Output is correct |
22 |
Correct |
355 ms |
848 KB |
Output is correct |
23 |
Correct |
598 ms |
604 KB |
Output is correct |
24 |
Correct |
575 ms |
600 KB |
Output is correct |
25 |
Correct |
545 ms |
624 KB |
Output is correct |
26 |
Correct |
558 ms |
604 KB |
Output is correct |
27 |
Correct |
501 ms |
852 KB |
Output is correct |
28 |
Correct |
536 ms |
848 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1051 ms |
1252 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |