답안 #715474

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
715474 2023-03-27T04:14:30 Z vjudge1 쌀 창고 (IOI11_ricehub) C++14
100 / 100
15 ms 3284 KB
#include <bits/stdc++.h>
#define ll long long
#include "ricehub.h"
//#include "grader.cpp"
 
using namespace std;
 
ll x[100010], qs[100010];
 
int besthub(int R, int L, int _X[], ll B) {
    for (int i = 1; i <= R; ++i) x[i] = _X[i-1];
    for (int i = 1; i <= R; ++i) qs[i] = qs[i-1] + x[i];
 
    ll l = 1, r = R;
    while (l < r) {
        ll mid = (l+r+1)/2;
        bool y = 0;
        for (ll i = 1, j = mid; j <= R; ++i, ++j) {
            ll md = (i+j)/2;
            if (qs[j]-qs[md]-(j-md)*x[md] + (md-i)*x[md]-qs[md-1]+qs[i-1] <= B) y = 1;
        }
        if (y) l = mid;
        else r = mid-1;
    }
    return l;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 308 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 312 KB Output is correct
13 Correct 0 ms 308 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 312 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 240 KB Output is correct
5 Correct 1 ms 304 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 2 ms 340 KB Output is correct
23 Correct 1 ms 468 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 440 KB Output is correct
26 Correct 1 ms 352 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 724 KB Output is correct
2 Correct 3 ms 724 KB Output is correct
3 Correct 13 ms 3284 KB Output is correct
4 Correct 15 ms 3224 KB Output is correct
5 Correct 7 ms 1604 KB Output is correct
6 Correct 7 ms 1620 KB Output is correct
7 Correct 13 ms 3040 KB Output is correct
8 Correct 11 ms 2912 KB Output is correct
9 Correct 7 ms 1492 KB Output is correct
10 Correct 6 ms 1492 KB Output is correct
11 Correct 14 ms 3284 KB Output is correct
12 Correct 15 ms 3256 KB Output is correct
13 Correct 7 ms 1620 KB Output is correct
14 Correct 7 ms 1596 KB Output is correct
15 Correct 10 ms 2516 KB Output is correct
16 Correct 9 ms 2492 KB Output is correct
17 Correct 14 ms 2952 KB Output is correct
18 Correct 15 ms 2944 KB Output is correct
19 Correct 13 ms 3140 KB Output is correct
20 Correct 12 ms 3048 KB Output is correct