Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Bismillahir Rahmanir Rahim
- //============================
- #include<bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define endl "\n"
- #define infL LLONG_MAX
- #define infI INT_MAX
- #define pb push_back
- #define fo(i,a,b) for(int i=a;i<b;i++)
- #define fo2(i,a,b) for(int i=a;i<=b;i++)
- #define precise(x,y)cout<<fixed<<setprecision(y)<<x<<endl;
- #define MAX 100010
- #define yes cout<<"YES"<<endl
- #define no cout<<"NO"<<endl
- #define bye return 0
- #define debug cout<<"\nDebug\n";
- #define debug2 cout<<"\nDebug2\n";
- #define PEREGRINE_FALCON {ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
- typedef pair<ll,ll>PII;
- double epsilon = 0.0000001f;
- ll mod=1e9+7;
- ll Pi =acos(-1);
- void print(vector<ll>V)
- {
- cout<<"\n---------------Vector checking start-------------------\n";
- ll sz=V.size();
- fo(i,0,sz){cout<<V[i]<<" ";}
- cout<<"\n----------------Vector checking end--------------------\n";
- }
- void print(ll arr[], ll n)
- {
- cout<<"\n---------------Array checking start-------------------\n";
- fo(i,0,n){cout<<arr[i]<<" ";}
- cout<<"\n----------------Array checking end--------------------\n";
- }
- int main()
- {
- PEREGRINE_FALCON
- //freopen("inputNew.txt", "r", stdin);
- ll testCase=1;
- //cin>>testCase;
- while(testCase--){
- ll n,m,k,x,y,z,a,b,c,d,mn,mx,temp,cnt,ans,sum,sz,len;
- cin>>n;
- ll arr[n];
- fo(i,0,n){cin>>arr[i];}
- mx= arr[0];
- for(int i=0; i<n; i++){
- mn=arr[i];
- for(int j=i; j<n; j++){
- mn=min(mn,arr[j]);
- mx=max(mx,(j-i+1)*mn);
- }
- }
- cout<<mx<<endl;
- }
- bye;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement