답안 #218434

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
218434 2020-04-02T07:23:18 Z KoalaMuch 쌀 창고 (IOI11_ricehub) C++14
100 / 100
25 ms 2560 KB
#include "ricehub.h"
//#include "grader.cpp"
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5+5;
long long qs[N];
int besthub(int R, int L, int X[], long long B)
{
    int lo = 1,hi = R;
    for(long long i=R;i>=1;i--) X[i] = X[i-1];
    for(int i=1;i<=R;i++)   qs[i] = qs[i-1]+X[i];
    while(lo<hi)
    {
        int mid = (lo+hi+1) >> 1;
        long long mn = 1e18;
        for(int i=1;i<=R-mid+1;i++)
        {
            int st = i,en = i+mid-1;
            int div = (st+en) >> 1;
            long long suml = qs[div]-qs[st-1],sumr = qs[en]-qs[div],lenl = div-st+1,lenr = en-div;
            mn = min(mn,lenl*X[div]-suml+sumr-lenr*X[div]);
        }
        if(mn<=B)   lo=mid;
        else        hi=mid-1;
    }
    return lo;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 4 ms 384 KB Output is correct
19 Correct 4 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 6 ms 512 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 5 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 640 KB Output is correct
2 Correct 8 ms 640 KB Output is correct
3 Correct 21 ms 2560 KB Output is correct
4 Correct 20 ms 2560 KB Output is correct
5 Correct 14 ms 1280 KB Output is correct
6 Correct 13 ms 1280 KB Output is correct
7 Correct 18 ms 2304 KB Output is correct
8 Correct 18 ms 2304 KB Output is correct
9 Correct 13 ms 1152 KB Output is correct
10 Correct 13 ms 1152 KB Output is correct
11 Correct 22 ms 2560 KB Output is correct
12 Correct 22 ms 2552 KB Output is correct
13 Correct 13 ms 1280 KB Output is correct
14 Correct 14 ms 1408 KB Output is correct
15 Correct 25 ms 2048 KB Output is correct
16 Correct 18 ms 2176 KB Output is correct
17 Correct 22 ms 2304 KB Output is correct
18 Correct 20 ms 2304 KB Output is correct
19 Correct 21 ms 2432 KB Output is correct
20 Correct 21 ms 2432 KB Output is correct