답안 #895781

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
895781 2023-12-30T20:16:15 Z vjudge1 쌀 창고 (IOI11_ricehub) C++17
26 / 100
1000 ms 3420 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long int

int besthub(int N, int L, int A[], long long B) {
    vector<ll> p(N + 1);
    p[0] = 0;
    for (ll i = 1; i <= N; i++) {
        p[i] = A[i - 1];
        p[i] += p[i - 1];
    }
    ll ans = 0;
    for (ll i = 1; i <= N; i++) {
        ll temp = 1;
        while (temp <= N - 1) {
            ll median = (temp + i) / 2 + 1;
            ll sum = (p[temp + 1] - p[median]) - (temp + 1 - median) * A[median - 1] + 
                            (median - (i - 1)) * A[median - 1] - (p[median] - p[i - 1]);
            if (sum > B) {
                break;
            }
            temp++;
        }
        ans = max(ans, temp - (i - 1));
    }
    return ans;
}

// ll main() {
//     ios_base::sync_with_stdio(0);
//     cin.tie(0);
//     cout.tie(0);
//     ll R, L;
//     cin >> R >> L;
//     ll X[R];
//     for (ll i = 0; i < R; i++) {
//         cin >> X[i];
//     }
//     ll B;
//     cin >> B;
//     cout << besthub(R, L, X, B) << "\n";
// }
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 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 348 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 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 440 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Incorrect 1 ms 348 KB Output isn't correct
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 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 0 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 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 2 ms 544 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 2 ms 348 KB Output is correct
20 Correct 2 ms 348 KB Output is correct
21 Correct 1 ms 396 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 43 ms 600 KB Output is correct
24 Correct 43 ms 480 KB Output is correct
25 Correct 43 ms 344 KB Output is correct
26 Correct 45 ms 344 KB Output is correct
27 Correct 13 ms 344 KB Output is correct
28 Correct 13 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 2 ms 472 KB Output is correct
3 Execution timed out 1033 ms 3420 KB Time limit exceeded
4 Halted 0 ms 0 KB -