답안 #991579

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
991579 2024-06-02T13:50:39 Z thinknoexit 쌀 창고 (IOI11_ricehub) C++17
100 / 100
11 ms 3676 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 100100;
int n;
ll x[N];
ll qs[N];
int besthub(int NN, int L, int X[], ll B) {
    n = NN;
    for (int i = 1;i <= n;i++) {
        x[i] = X[i - 1];
        qs[i] = qs[i - 1] + x[i];
    }
    int ans = 0;
    for (int i = 1, j = 1;i <= n;i++) {
        while (j < i) {
            int med = (i + j) / 2;
            ll suml = qs[med] - qs[j - 1];
            ll sumr = qs[i] - qs[med];
            if ((x[med] * (med - j + 1) - suml) + (sumr - x[med] * (i - med)) > B) j++;
            else break;
        }
        ans = max(ans, i - j + 1);
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2500 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Correct 0 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 0 ms 2396 KB Output is correct
23 Correct 0 ms 2396 KB Output is correct
24 Correct 0 ms 2396 KB Output is correct
25 Correct 1 ms 2392 KB Output is correct
26 Correct 1 ms 2392 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2500 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 0 ms 2392 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 0 ms 2440 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2504 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2512 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2652 KB Output is correct
2 Correct 2 ms 2652 KB Output is correct
3 Correct 8 ms 3676 KB Output is correct
4 Correct 9 ms 3628 KB Output is correct
5 Correct 4 ms 2908 KB Output is correct
6 Correct 4 ms 2860 KB Output is correct
7 Correct 9 ms 3420 KB Output is correct
8 Correct 11 ms 3268 KB Output is correct
9 Correct 4 ms 2908 KB Output is correct
10 Correct 5 ms 2908 KB Output is correct
11 Correct 8 ms 3676 KB Output is correct
12 Correct 9 ms 3504 KB Output is correct
13 Correct 4 ms 2908 KB Output is correct
14 Correct 4 ms 2908 KB Output is correct
15 Correct 7 ms 3420 KB Output is correct
16 Correct 6 ms 3420 KB Output is correct
17 Correct 8 ms 3420 KB Output is correct
18 Correct 8 ms 3420 KB Output is correct
19 Correct 9 ms 3676 KB Output is correct
20 Correct 9 ms 3676 KB Output is correct