Submission #19679949


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

using vb = vector<bool>;
using vi = vector<int>;
using vll = vector<long long>;

using pii = pair<int, int>;
using pll = pair<long long, long long>;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

constexpr long long mod = 1000000007;

#define rep(i, n) for (ll i = 0; i < n; i++)
#define repi(i, a, b) for (ll i = a; i < b; i++)
#define repa(i, a) for (auto i : a)

#define all(x) (x).begin(), (x).end()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    ll n;
    cin >> n;

    vll a(n);
    rep(i, n) cin >> a[i];

    ll ans = 0;
    rep(i, n) {
        ll m = a[i];
        ll sum;
        repi(j, i, n) {
            m = min(a[j], m);

            sum = m * (j - i + 1);

            ans = max(sum, ans);
        }
    }

    cout << ans << endl;
}

Submission Info

Submission Time
Task C - Mandarin Orange
User himajin008
Language C++ (GCC 9.2.1)
Score 300
Code Size 897 Byte
Status AC
Exec Time 60 ms
Memory 3732 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 33
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All min_01.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, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
min_01.txt AC 10 ms 3664 KiB
random_01.txt AC 41 ms 3692 KiB
random_02.txt AC 37 ms 3644 KiB
random_03.txt AC 60 ms 3584 KiB
random_04.txt AC 38 ms 3732 KiB
random_05.txt AC 42 ms 3688 KiB
random_06.txt AC 55 ms 3708 KiB
random_07.txt AC 39 ms 3692 KiB
random_08.txt AC 35 ms 3632 KiB
random_09.txt AC 58 ms 3576 KiB
random_10.txt AC 41 ms 3684 KiB
random_11.txt AC 41 ms 3688 KiB
random_12.txt AC 57 ms 3648 KiB
random_13.txt AC 41 ms 3640 KiB
random_14.txt AC 42 ms 3560 KiB
random_15.txt AC 53 ms 3704 KiB
random_16.txt AC 41 ms 3572 KiB
random_17.txt AC 44 ms 3644 KiB
random_18.txt AC 55 ms 3704 KiB
random_19.txt AC 42 ms 3644 KiB
random_20.txt AC 40 ms 3620 KiB
random_21.txt AC 56 ms 3580 KiB
random_22.txt AC 43 ms 3548 KiB
random_23.txt AC 39 ms 3512 KiB
random_24.txt AC 55 ms 3588 KiB
random_25.txt AC 39 ms 3512 KiB
random_26.txt AC 42 ms 3616 KiB
random_27.txt AC 57 ms 3708 KiB
random_28.txt AC 40 ms 3688 KiB
random_29.txt AC 43 ms 3568 KiB
random_30.txt AC 54 ms 3688 KiB
sample_01.txt AC 2 ms 3496 KiB
sample_02.txt AC 1 ms 3488 KiB