답안 #969919

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
969919 2024-04-25T20:43:39 Z urieg 쌀 창고 (IOI11_ricehub) C++17
74 / 100
21 ms 4260 KB

#include <bits/stdc++.h>
#include "ricehub.h"
using namespace std;
typedef long long ll;
/// for moondance

int besthub(int R, int L, int X[], long long B){

    vector<ll>x(R), p(R);
    for(int i=0;i<R;i++){
        x[i] = X[i];
        p[i] = x[i];
        if(i)p[i] += p[i-1];
    }
    int ans = 1;
    for(int i=0;i<R;i++){
        int l = 1, r = R;
        while(l<r){
            int m = (l+r+1)/2;
//            cout<<m<<endl;
            int l_ = i-m/2+(1-m%2), r_ = i+m/2;
            if(l_<0 || r_>=R){
                r = m-1;
                continue;
            }
            ll sum = p[r_] - p[i] - (x[i]*(r_-i));
            sum += x[i]*(i-l_+1) - (!l_ ? 0 : p[i]-p[l_-1]);
//            cout<<sum<<endl;
            if(sum <= B)l = m;
            else r = m-1;
        }
        ans = max(ans, l);
    }
    return ans;
}




# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 600 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Incorrect 1 ms 348 KB Output isn't correct
26 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 16 ms 4252 KB Output is correct
4 Correct 17 ms 4184 KB Output is correct
5 Correct 7 ms 3420 KB Output is correct
6 Correct 7 ms 3444 KB Output is correct
7 Correct 16 ms 4188 KB Output is correct
8 Correct 17 ms 4184 KB Output is correct
9 Correct 7 ms 3420 KB Output is correct
10 Correct 7 ms 3420 KB Output is correct
11 Correct 21 ms 4260 KB Output is correct
12 Correct 17 ms 4184 KB Output is correct
13 Correct 8 ms 3420 KB Output is correct
14 Correct 8 ms 3316 KB Output is correct
15 Correct 14 ms 3676 KB Output is correct
16 Correct 13 ms 3676 KB Output is correct
17 Correct 15 ms 3932 KB Output is correct
18 Correct 15 ms 4076 KB Output is correct
19 Correct 16 ms 3932 KB Output is correct
20 Correct 16 ms 4176 KB Output is correct