답안 #730521

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
730521 2023-04-26T04:52:57 Z t6twotwo 쌀 창고 (IOI11_ricehub) C++17
100 / 100
19 ms 2516 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
int besthub(int N, int L, int X[], long long B) {
    vector<int64_t> pfs(N + 1);
    for (int i = 0; i < N; i++) {
        pfs[i + 1] = pfs[i] + X[i];
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
        int lo = i, hi = N - 1;
        while (lo < hi) {
            int x = (lo + hi + 1) / 2;
            int p = (i + x) / 2;
            if ((pfs[x + 1] - pfs[p + 1]) - (pfs[p + 1] - pfs[i]) + 1LL * X[p] * ((p + 1 - i) - (x - p)) <= B) {
                lo = x;
            } else {
                hi = x - 1;
            }
        }
        ans = max(ans, lo + 1 - i);
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 312 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 224 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 308 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 312 KB Output is correct
21 Correct 0 ms 312 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 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 312 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 312 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 212 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 316 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 316 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 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 340 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 4 ms 596 KB Output is correct
2 Correct 3 ms 724 KB Output is correct
3 Correct 15 ms 2460 KB Output is correct
4 Correct 15 ms 2516 KB Output is correct
5 Correct 7 ms 1220 KB Output is correct
6 Correct 8 ms 1220 KB Output is correct
7 Correct 14 ms 2224 KB Output is correct
8 Correct 13 ms 2260 KB Output is correct
9 Correct 9 ms 1200 KB Output is correct
10 Correct 7 ms 1108 KB Output is correct
11 Correct 17 ms 2508 KB Output is correct
12 Correct 15 ms 2516 KB Output is correct
13 Correct 8 ms 1236 KB Output is correct
14 Correct 8 ms 1252 KB Output is correct
15 Correct 15 ms 1880 KB Output is correct
16 Correct 16 ms 1876 KB Output is correct
17 Correct 15 ms 2260 KB Output is correct
18 Correct 14 ms 2208 KB Output is correct
19 Correct 19 ms 2380 KB Output is correct
20 Correct 14 ms 2388 KB Output is correct