Submission #19683367


Source Code Expand

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <sstream>
using namespace std;
int f(vector<int> &a){
    if (a.size()==0) return 0;
    if (a.size()==1) return a[0];
    int m=*min_element(a.begin(),a.end());
    auto mI=min_element(a.begin(),a.end());
    int score=a.size()*m;
    vector< int > b={a.begin(),mI};
    vector< int > c={mI+1,a.end()};
    score=max(score,f(b));
    return(max(score,f(c)));







}

int main() {
    int n;
    cin>>n;
    vector< int > a(n);
    int input;
    for(int i=0; i<n; i++){
        cin>>input;
        a[i]=input;
    }
    cout<<f(a);
/*    vector< int > b(a);
    sort(b.begin(),b.end(),greater<int>());
    for (int i=n-1;i>0;i--){
        if (b[i]==b[i-1]) b.erase(i);
    }

*/

    return 0;
}

Submission Info

Submission Time
Task C - Mandarin Orange
User MadhurIITB
Language C++ (GCC 9.2.1)
Score 300
Code Size 887 Byte
Status AC
Exec Time 256 ms
Memory 200356 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 9 ms 3608 KiB
random_01.txt AC 10 ms 3616 KiB
random_02.txt AC 7 ms 3652 KiB
random_03.txt AC 8 ms 3820 KiB
random_04.txt AC 7 ms 3704 KiB
random_05.txt AC 9 ms 3756 KiB
random_06.txt AC 9 ms 3756 KiB
random_07.txt AC 8 ms 3624 KiB
random_08.txt AC 10 ms 3736 KiB
random_09.txt AC 11 ms 3652 KiB
random_10.txt AC 9 ms 3752 KiB
random_11.txt AC 14 ms 3752 KiB
random_12.txt AC 10 ms 3688 KiB
random_13.txt AC 30 ms 15788 KiB
random_14.txt AC 27 ms 16712 KiB
random_15.txt AC 39 ms 21416 KiB
random_16.txt AC 25 ms 15260 KiB
random_17.txt AC 24 ms 15768 KiB
random_18.txt AC 39 ms 20484 KiB
random_19.txt AC 29 ms 15948 KiB
random_20.txt AC 22 ms 14640 KiB
random_21.txt AC 37 ms 21876 KiB
random_22.txt AC 26 ms 16496 KiB
random_23.txt AC 23 ms 15336 KiB
random_24.txt AC 38 ms 21424 KiB
random_25.txt AC 171 ms 135972 KiB
random_26.txt AC 173 ms 135904 KiB
random_27.txt AC 252 ms 200272 KiB
random_28.txt AC 175 ms 135756 KiB
random_29.txt AC 174 ms 135824 KiB
random_30.txt AC 256 ms 200356 KiB
sample_01.txt AC 2 ms 3556 KiB
sample_02.txt AC 2 ms 3608 KiB