-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBob and Container.cpp
More file actions
43 lines (40 loc) · 816 Bytes
/
Copy pathBob and Container.cpp
File metadata and controls
43 lines (40 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define re(i, n) for(int i = 0; i < n; i++)
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define ren(i,a,b) for(int i = (a); i >= (b); i--)
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define ss(s) scanf("%s",s)
#define pi(x) printf("%d\n",x)
#define pl(x) printf("%lld\n",x)
#define ps(s) printf("%s\n",s)
int main()
{
std::ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
ll max = 0;
si(n);
std::vector<int> v(n);
re(i ,n)
si(v[i]);
re(i ,n)
{
if(max >= (n-1 - i)*v[i])
continue;
ren(j ,n-1, i+1)
{
if(max < (j-i)*min(v[i] , v[j]))
max = (j-i)*min(v[i] , v[j]);
if(v[i] <= v[j])
break;
}
}
pl(max);
return 0;
}