Submission #49314830


Source Code Expand

// #include <atcoder/all>
#include <bits/stdc++.h>

using namespace std;
// using namespace atcoder;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(auto &ta : a)
        cin >> ta;

    int lc = 1;
    int rc = 1;
    int li = 0;
    int ri = n - 1;
    int ans = 1;
    bool lf = false;
    while(li < ri) {
        if(lc > a[li]) {
            lc = a[li];
        }

        if(rc > a[ri]) {
            rc = a[ri];
        }

        if(rc < lc) {
            ans = max(ans, (rc + 1) / 2);
            rc++;
            ri--;
            lf = false;
        } else {
            ans = max(ans, (lc + 1) / 2);
            lc++;
            li++;
            lf = true;
        }
    }
    if(lf) {
        lc--;
    } else {
        rc--;
    }
    int tmp;
    if(lc < rc) {
        tmp = lc + 1;
    } else if(lc > rc) {
        tmp = rc + 1;
    } else {
        tmp = lc;
    }

    ans = max(ans, tmp);

    cout << ans << endl;

    return 0;
}

Submission Info

Submission Time
Task D - Pyramid
User nnth_y
Language C++ 20 (gcc 12.2)
Score 0
Code Size 1035 Byte
Status WA
Exec Time 52 ms
Memory 4124 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 29
WA × 13
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt, random_30.txt, random_31.txt, random_32.txt
Case Name Status Exec Time Memory
example_00.txt AC 1 ms 3484 KiB
example_01.txt AC 1 ms 3616 KiB
example_02.txt AC 1 ms 3452 KiB
hand_00.txt AC 52 ms 3876 KiB
hand_01.txt AC 17 ms 3860 KiB
hand_02.txt AC 34 ms 3956 KiB
hand_03.txt AC 33 ms 4024 KiB
hand_04.txt AC 31 ms 3952 KiB
hand_05.txt AC 33 ms 3892 KiB
random_00.txt AC 48 ms 3864 KiB
random_01.txt WA 48 ms 3960 KiB
random_02.txt AC 48 ms 3968 KiB
random_03.txt WA 31 ms 3948 KiB
random_04.txt WA 31 ms 3968 KiB
random_05.txt WA 31 ms 3880 KiB
random_06.txt WA 31 ms 3896 KiB
random_07.txt WA 31 ms 3952 KiB
random_08.txt WA 32 ms 3932 KiB
random_09.txt AC 32 ms 4124 KiB
random_10.txt AC 31 ms 3932 KiB
random_11.txt WA 31 ms 4036 KiB
random_12.txt WA 32 ms 3884 KiB
random_13.txt AC 31 ms 3964 KiB
random_14.txt AC 31 ms 3912 KiB
random_15.txt AC 32 ms 4124 KiB
random_16.txt AC 31 ms 4032 KiB
random_17.txt WA 31 ms 3916 KiB
random_18.txt AC 31 ms 3864 KiB
random_19.txt AC 31 ms 3932 KiB
random_20.txt AC 31 ms 4032 KiB
random_21.txt AC 32 ms 3860 KiB
random_22.txt WA 31 ms 3868 KiB
random_23.txt AC 31 ms 3972 KiB
random_24.txt AC 32 ms 3948 KiB
random_25.txt WA 31 ms 4116 KiB
random_26.txt WA 30 ms 3876 KiB
random_27.txt AC 33 ms 3980 KiB
random_28.txt AC 33 ms 3980 KiB
random_29.txt AC 33 ms 3956 KiB
random_30.txt AC 34 ms 4024 KiB
random_31.txt AC 34 ms 3912 KiB
random_32.txt AC 33 ms 3956 KiB