이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXR = 111111;
typedef long long lld;
lld psum[MAXR];
lld interval( int i, int j ) {
// [i, j]
int m = (i + j)/2, x = psum[m] - psum[m-1];
return ( 2*m - i - j ) * 1LL * x - psum[m-1] + psum[i-1] + psum[j] - psum[m];
}
int besthub(int R, int L, int X[], long long B)
{
for(int i=1; i<=R; i++) psum[i] = psum[i-1] + X[i-1];
int j = 1, ret = 0;
for(int i=1; i<=R; i++)
while( j<=R && interval(i, j) <= B ) ret = max( ret, j-i+1), j++;
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |