#include <bits/stdc++.h>
#include <iostream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> order_set;
mt19937 mt_rand(chrono::high_resolution_clock::now().time_since_epoch().count());
//uniform_int_distribution<int> gen; ///(min, max)
//int random() {return gen(mt_rand);}
const int mxN=1e5+5;
const int mod=998244353;
const int mxlogN=40;
const int mxK=26;
const int inf=2e9;
const int K=600;
int a[mxN];
#include "ricehub.h"
int besthub(int n, int L, int X[], ll B)
{
int ans=0;
for(int i=0; i<n; i++)
{
int p=X[i];
vector<int> a(n);
for(int i=0; i<n; i++) a[i]=abs(X[i]-p);
sort(a.begin(),a.end());
ll x=B;
int j=0;
while(j<n&&a[j]<=x) x-=a[j++];
ans=max(ans,j);
}
return ans;
}
/*
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
}
*/
/*
7 3
4 1 3 4 0 2 3
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
316 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
320 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
324 KB |
Output is correct |
6 |
Correct |
1 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 |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
324 KB |
Output is correct |
15 |
Correct |
1 ms |
324 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
328 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
3 ms |
212 KB |
Output is correct |
22 |
Correct |
3 ms |
212 KB |
Output is correct |
23 |
Correct |
5 ms |
324 KB |
Output is correct |
24 |
Correct |
5 ms |
212 KB |
Output is correct |
25 |
Correct |
6 ms |
328 KB |
Output is correct |
26 |
Correct |
5 ms |
324 KB |
Output is correct |
27 |
Correct |
5 ms |
212 KB |
Output is correct |
28 |
Correct |
7 ms |
324 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
15 ms |
336 KB |
Output is correct |
4 |
Correct |
15 ms |
336 KB |
Output is correct |
5 |
Correct |
3 ms |
212 KB |
Output is correct |
6 |
Correct |
3 ms |
212 KB |
Output is correct |
7 |
Correct |
11 ms |
340 KB |
Output is correct |
8 |
Correct |
11 ms |
212 KB |
Output is correct |
9 |
Correct |
5 ms |
324 KB |
Output is correct |
10 |
Correct |
5 ms |
324 KB |
Output is correct |
11 |
Correct |
13 ms |
212 KB |
Output is correct |
12 |
Correct |
12 ms |
340 KB |
Output is correct |
13 |
Correct |
20 ms |
328 KB |
Output is correct |
14 |
Correct |
19 ms |
212 KB |
Output is correct |
15 |
Correct |
7 ms |
324 KB |
Output is correct |
16 |
Correct |
5 ms |
212 KB |
Output is correct |
17 |
Correct |
12 ms |
340 KB |
Output is correct |
18 |
Correct |
12 ms |
336 KB |
Output is correct |
19 |
Correct |
19 ms |
212 KB |
Output is correct |
20 |
Correct |
19 ms |
212 KB |
Output is correct |
21 |
Correct |
300 ms |
360 KB |
Output is correct |
22 |
Correct |
341 ms |
360 KB |
Output is correct |
23 |
Correct |
673 ms |
372 KB |
Output is correct |
24 |
Correct |
646 ms |
368 KB |
Output is correct |
25 |
Correct |
609 ms |
380 KB |
Output is correct |
26 |
Correct |
624 ms |
380 KB |
Output is correct |
27 |
Correct |
550 ms |
460 KB |
Output is correct |
28 |
Correct |
545 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1072 ms |
596 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |