답안 #914758

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
914758 2024-01-22T16:09:55 Z DucNguyen2007 쌀 창고 (IOI11_ricehub) C++14
0 / 100
1000 ms 2468 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxN=1e5+5;
ll sum[maxN+1];
int a[maxN+1];
ll get(ll l,ll r)
{
    if(l==0)
    {
        return sum[r];
    }
    else return sum[r]-sum[l-1];
}
ll besthub(int L,int n,int a[],ll B)
{
    sum[0]=a[0];
    for(int i=1;i<n;i++)
    {
        sum[i]=sum[i-1]+a[i];
    }
    ll res=0;
    for(int len=1;len<=n;len++)
    {
        ll l=0,r=len-1;
        while(r<n)
        {
            ll cur=a[r]-a[l];
            //cout<<l<<" "<<r<<" "<<p<<" "<<cur<<'\n';
            if(cur<=B)
            {
                res=max(res,1LL*len);
            }
            l++;
            r++;
        }
    }
    return res;
}

# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 42 ms 2468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1016 ms 2392 KB Time limit exceeded
2 Halted 0 ms 0 KB -