#include<bits/stdc++.h>
#include<ricehub.h>
using namespace std;
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define x first
#define y second
#define pi pair <int, int>
#define pii pair <int, pi>
#define vi vector <int>
const ll mod = 998244353;
int besthub(int n, int l, int x[], ll b){
ll s[n+1];
int ans=0;
s[0]=1LL*x[0];
s[n]=1000000000000000000;
for(int i=1; i<n; i++) s[i]=s[i-1]+x[i];
for(int i=0; i<n; i++){
int l=0, r=n-i;
while(r-l>1){
int mid=(l+r)>>1;
int start=i, end=i+mid;
int xd=(start+end)/2;
if((1LL*x[xd]*(2*xd-start-end)-1LL*s[xd-1]+1LL*s[start-1]+1LL*s[end]-1LL*s[xd])<=b) l=mid;
else r=mid;
}
ans=max(ans, l);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
508 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |