답안 #526562

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
526562 2022-02-15T08:40:56 Z ToroTN 쌀 창고 (IOI11_ricehub) C++14
100 / 100
17 ms 3304 KB
#include<bits/stdc++.h>
using namespace std;
#include "ricehub.h"
long long n,m,a[100005],b,st,md,ed,qs[100005],l,r,siz,md1,md2,type;
long long query(long long l,long long r)
{
    return qs[r]-qs[l-1];
}
int besthub(int R,int L,int X[],long long B)
{
    n=(long long)R;
    m=(long long)L;
    for(int i=1;i<=n;i++)
    {
        a[i]=(long long)X[i-1];
        qs[i]=qs[i-1]+a[i];
    }
    b=B;
    st=1;
    ed=n;
    /*for(int i=1;i<=n;i++)
    {
        printf("%lld ",qs[i]);
    }
    printf("\n");*/
    while(ed>=st)
    {
        md=(st+ed)/2;
        siz=md/2;
        type=-1;
        for(int i=1;i<=n-md+1;i++)
        {
            l=i;
            r=i+md-1;
            md1=l+siz-1;
            md2=r-siz+1;
            if(query(md2,r)-query(l,md1)<=b)
            {
                type=0;
            }
        }
        if(type==0)
        {
            st=md+1;
        }else
        {
            ed=md-1;
        }
    }
    //printf("%lld %lld %lld\n",st,md,ed);
    return ed;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 280 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 264 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 296 KB Output is correct
7 Correct 1 ms 300 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 300 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 300 KB Output is correct
26 Correct 1 ms 300 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 0 ms 300 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 216 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 304 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 300 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 312 KB Output is correct
22 Correct 1 ms 304 KB Output is correct
23 Correct 1 ms 440 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 804 KB Output is correct
2 Correct 3 ms 820 KB Output is correct
3 Correct 12 ms 3256 KB Output is correct
4 Correct 12 ms 3232 KB Output is correct
5 Correct 6 ms 1540 KB Output is correct
6 Correct 8 ms 1552 KB Output is correct
7 Correct 10 ms 2968 KB Output is correct
8 Correct 11 ms 2884 KB Output is correct
9 Correct 6 ms 1608 KB Output is correct
10 Correct 6 ms 1576 KB Output is correct
11 Correct 16 ms 3304 KB Output is correct
12 Correct 12 ms 3224 KB Output is correct
13 Correct 6 ms 1628 KB Output is correct
14 Correct 6 ms 1588 KB Output is correct
15 Correct 10 ms 2512 KB Output is correct
16 Correct 9 ms 2496 KB Output is correct
17 Correct 10 ms 2928 KB Output is correct
18 Correct 10 ms 2920 KB Output is correct
19 Correct 17 ms 3088 KB Output is correct
20 Correct 11 ms 3136 KB Output is correct