Submission #1814896


Source Code Expand

#include <bits/stdc++.h>

using namespace std;
long n;
long a[200050];
long long kq=0;
int main(){
ios::sync_with_stdio(0);
cin.tie(NULL);cout.tie(NULL);
    cin>>n;
    for(int i=1;i<=n;++i)
        cin>>a[i];
    for(int i=1;i<=n;++i)
    {
        long ii=1,jj=1;
        while(a[i-ii]>a[i])
        {
            ii++;
            if(i-ii==0) break;
        }
        while(a[i+jj]>a[i])
        {
            jj++;
            if(i+jj==n+1) break;
        }
      //  cout<<a[i]<<" "<<ii<< " "<<jj<<endl;
        kq+=a[i]*ii*jj;
    }
cout<<kq;


}

Submission Info

Submission Time
Task B - Minimum Sum
User vjudge5
Language C++14 (GCC 5.4.1)
Score 0
Code Size 554 Byte
Status TLE
Exec Time 2103 ms
Memory 1792 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 10
TLE × 3
Set Name Test Cases
Sample example0, example1, example2
All corner0, corner1, corner2, corner3, example0, example1, example2, maxrand0, maxrand1, maxrand2, rand0, rand1, rand2
Case Name Status Exec Time Memory
corner0 TLE 2103 ms 1792 KB
corner1 TLE 2103 ms 1792 KB
corner2 AC 1 ms 256 KB
corner3 TLE 2103 ms 1792 KB
example0 AC 1 ms 256 KB
example1 AC 1 ms 256 KB
example2 AC 1 ms 256 KB
maxrand0 AC 23 ms 1792 KB
maxrand1 AC 24 ms 1792 KB
maxrand2 AC 23 ms 1792 KB
rand0 AC 1 ms 256 KB
rand1 AC 1 ms 256 KB
rand2 AC 1 ms 256 KB