이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
#include "ricehub.h"
using namespace std;
long long prefixy[100100];
long long mam[100100];
long long oblicz(int x,int y)
{
    int srodek=(x+y)/2;
    long long wynik_pomoc=mam[srodek]*(srodek-x)-(prefixy[srodek-1]-prefixy[x-1]);
    long long wynik_pom=(prefixy[y]-prefixy[srodek])-mam[srodek]*(y-srodek);
    return wynik_pomoc+wynik_pom;
}
int besthub(int n,int l,int tak[],long long b)
{
    long long wynik=0,j=1,wynik_pom;
    for(int i=0;i<n;i++)
        mam[i+1]=tak[i];
    for(int i=1;i<=n;i++)
    {
        prefixy[i]=prefixy[i-1];
        prefixy[i]+=mam[i];
    }
    for(int i=1;i<=n;i++)
    {
        wynik_pom=oblicz(i,j+1);
        while(j<n && wynik_pom<=b)
        {
            j++;
            wynik_pom=oblicz(i,j+1);
        }
        if((j-i+1)>wynik)
            wynik=(j-i+1);
    }
    return wynik;
}
| # | 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... |