Advertisement
Mohammad_Rakib

Untitled

Jan 24th, 2021
721
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.86 KB | None | 0 0
  1. // Bismillahir Rahmanir Rahim
  2. //============================
  3. #include<bits/stdc++.h>
  4. using namespace std;
  5.  
  6. #define ll          long long
  7. #define endl        "\n"
  8. #define infL        LLONG_MAX
  9. #define infI        INT_MAX
  10. #define pb          push_back
  11. #define fo(i,a,b)   for(int i=a;i<b;i++)
  12. #define fo2(i,a,b)   for(int i=a;i<=b;i++)
  13. #define precise(x,y)cout<<fixed<<setprecision(y)<<x<<endl;
  14. #define MAX         100010
  15. #define yes         cout<<"YES"<<endl
  16. #define no          cout<<"NO"<<endl
  17. #define bye         return 0
  18. #define debug       cout<<"\nDebug\n";
  19. #define debug2      cout<<"\nDebug2\n";
  20. #define PEREGRINE_FALCON {ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
  21.  
  22. typedef pair<ll,ll>PII;
  23. double epsilon = 0.0000001f;
  24. ll mod=1e9+7;
  25. ll Pi =acos(-1);
  26.  
  27. void print(vector<ll>V)
  28. {
  29.       cout<<"\n---------------Vector checking start-------------------\n";
  30.       ll sz=V.size();
  31.       fo(i,0,sz){cout<<V[i]<<"  ";}
  32.       cout<<"\n----------------Vector checking end--------------------\n";
  33. }
  34.  
  35. void print(ll arr[], ll n)
  36. {
  37.       cout<<"\n---------------Array checking start-------------------\n";
  38.       fo(i,0,n){cout<<arr[i]<<" ";}
  39.       cout<<"\n----------------Array checking end--------------------\n";
  40. }
  41.  
  42. int main()
  43. {
  44.       PEREGRINE_FALCON
  45.       //freopen("inputNew.txt", "r", stdin);
  46.  
  47.       ll testCase=1;
  48.       //cin>>testCase;
  49.       while(testCase--){
  50.             ll n,m,k,x,y,z,a,b,c,d,mn,mx,temp,cnt,ans,sum,sz,len;
  51.             cin>>n;
  52.             ll arr[n];
  53.             fo(i,0,n){cin>>arr[i];}
  54.  
  55.             mx= arr[0];
  56.             for(int i=0; i<n; i++){
  57.                   mn=arr[i];
  58.                   for(int j=i; j<n; j++){
  59.                         mn=min(mn,arr[j]);
  60.                         mx=max(mx,(j-i+1)*mn);
  61.                   }
  62.             }
  63.             cout<<mx<<endl;
  64.       }
  65.  
  66.       bye;
  67. }
  68.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement