답안 #1041065

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1041065 2024-08-01T14:41:06 Z inkvizytor 쌀 창고 (IOI11_ricehub) C++17
25 / 100
8 ms 4448 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> dp (R+1, 0);
    for (int i = 0; i < R; i++) {
        dp[i+1] = dp[i]+X[i];
    }
    int poc=1, kon=1;
    int score = 0;
    while (kon <= R) {
        int sr = (poc+kon)/2;
        if (!((kon-poc)%2)) {
            int s = dp[kon]-dp[sr]-dp[sr-1]+dp[poc-1];
            if (s <= B) {
                score = max(score, kon-poc+1);
                kon++;
            }
            else {
                poc++;
            }
        }
        else {
            int s = dp[kon]-dp[sr]*2+dp[poc-1];
            if (s <= B) {
                score = kon-poc+1;
                kon++;
            }
            else {
                poc++;
            }
        }
    }
    return score;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 456 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 448 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 604 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 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 452 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 600 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 1 ms 452 KB Output is correct
12 Correct 0 ms 352 KB Output is correct
13 Correct 1 ms 352 KB Output is correct
14 Correct 1 ms 352 KB Output is correct
15 Incorrect 0 ms 352 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 608 KB Output is correct
2 Correct 2 ms 608 KB Output is correct
3 Correct 8 ms 4364 KB Output is correct
4 Incorrect 8 ms 4448 KB Output isn't correct
5 Halted 0 ms 0 KB -