답안 #235011

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
235011 2020-05-26T17:43:27 Z muhammad_hokimiyon 쌀 창고 (IOI11_ricehub) C++14
100 / 100
31 ms 2304 KB
#include "ricehub.h"
#include <bits/stdc++.h>

using namespace std;

int besthub(int R, int L, int X[], long long B)
{
    vector < long long > p(R , 0);
    vector < long long > s(R , 0);
    for( int i = 0; i < R; i++ ){
        if( i )p[i] = p[i - 1];
        p[i] += X[i];
    }
    for( int i = R - 1; i >= 0; i-- ){
        if( i < R - 1 )s[i] = s[i + 1];
        s[i] += X[i];
    }
    int ans = 0;
    for( int i = 0; i < R; i++ ){
        int l = 0 , r = i;
        while( l < r ){
            int m = (l + r) / 2;
            int m1 = (m + i) / 2;
            long long x = X[m1];
            if( 1ll * x * (m1 - m + 1) - (p[m1] - (m > 0 ? p[m - 1] : 0)) +
               1ll * (p[i] - p[m1]) - x * (i - m1) > B )l = m + 1;
            else r = m;
        }
        ans = max( ans , i - l + 1 );
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 4 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 4 ms 256 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 4 ms 256 KB Output is correct
11 Correct 4 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 4 ms 256 KB Output is correct
14 Correct 4 ms 256 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 4 ms 256 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 4 ms 384 KB Output is correct
19 Correct 5 ms 256 KB Output is correct
20 Correct 4 ms 256 KB Output is correct
21 Correct 4 ms 256 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 4 ms 384 KB Output is correct
25 Correct 5 ms 256 KB Output is correct
26 Correct 5 ms 256 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 4 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 256 KB Output is correct
6 Correct 5 ms 256 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 512 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 4 ms 384 KB Output is correct
18 Correct 4 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 6 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 8 ms 768 KB Output is correct
2 Correct 8 ms 768 KB Output is correct
3 Correct 29 ms 2304 KB Output is correct
4 Correct 28 ms 2304 KB Output is correct
5 Correct 15 ms 1280 KB Output is correct
6 Correct 15 ms 1280 KB Output is correct
7 Correct 26 ms 2304 KB Output is correct
8 Correct 26 ms 2304 KB Output is correct
9 Correct 15 ms 1280 KB Output is correct
10 Correct 16 ms 1280 KB Output is correct
11 Correct 31 ms 2304 KB Output is correct
12 Correct 30 ms 2304 KB Output is correct
13 Correct 15 ms 1280 KB Output is correct
14 Correct 16 ms 1280 KB Output is correct
15 Correct 24 ms 1792 KB Output is correct
16 Correct 24 ms 1792 KB Output is correct
17 Correct 27 ms 2048 KB Output is correct
18 Correct 27 ms 2176 KB Output is correct
19 Correct 30 ms 2176 KB Output is correct
20 Correct 29 ms 2168 KB Output is correct