/*
bf sol
*/
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define ins insert
#define pb push_back
// #define int long long int
#define pii pair<int, int>
#define endl '\n'
#define drop(x) cout<<(x)<<endl; return;
#define all(x) x.begin(),x.end()
int besthub(int n, int mxL, int arr[], long long B){
int ans=0;
/*
her i ucun ele j tapaqki :
j<i
j ni goturmesek i+1 right terefden nese ekstra goture bilirik
*/
for(int i=0;i<n;i++){
multiset<int> lst;
int cnt=0;
for(int j=0;j<n;j++){
lst.ins(abs(arr[i]-arr[j]));
}
int sum=0;
for(auto v:lst){
if(sum+v>B){
break;
}
sum+=v;
cnt++;
}
ans=max(ans,cnt);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 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 |
448 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 |
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 |
1 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 |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
448 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
9 ms |
348 KB |
Output is correct |
22 |
Correct |
9 ms |
348 KB |
Output is correct |
23 |
Correct |
11 ms |
348 KB |
Output is correct |
24 |
Correct |
13 ms |
476 KB |
Output is correct |
25 |
Correct |
11 ms |
348 KB |
Output is correct |
26 |
Correct |
12 ms |
476 KB |
Output is correct |
27 |
Correct |
10 ms |
348 KB |
Output is correct |
28 |
Correct |
11 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
41 ms |
348 KB |
Output is correct |
4 |
Correct |
35 ms |
348 KB |
Output is correct |
5 |
Correct |
10 ms |
344 KB |
Output is correct |
6 |
Correct |
12 ms |
348 KB |
Output is correct |
7 |
Correct |
43 ms |
348 KB |
Output is correct |
8 |
Correct |
46 ms |
344 KB |
Output is correct |
9 |
Correct |
11 ms |
348 KB |
Output is correct |
10 |
Correct |
11 ms |
472 KB |
Output is correct |
11 |
Correct |
28 ms |
344 KB |
Output is correct |
12 |
Correct |
28 ms |
348 KB |
Output is correct |
13 |
Correct |
51 ms |
348 KB |
Output is correct |
14 |
Correct |
50 ms |
344 KB |
Output is correct |
15 |
Correct |
11 ms |
348 KB |
Output is correct |
16 |
Correct |
11 ms |
472 KB |
Output is correct |
17 |
Correct |
31 ms |
348 KB |
Output is correct |
18 |
Correct |
36 ms |
348 KB |
Output is correct |
19 |
Correct |
51 ms |
348 KB |
Output is correct |
20 |
Correct |
50 ms |
344 KB |
Output is correct |
21 |
Execution timed out |
1065 ms |
604 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1033 ms |
1372 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |