#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
int n;
cin>>n;
int a,b,mna[n][n],mnb[n][n];
for (int i=0;i<n;i++)
{
cin>>a>>b;
mna[i][i]=a;
mnb[i][i]=b;
}
for (int i=0;i<n;i++)
for (int j=i+1;j<n;j++)
mna[i][j]=min(mna[i][j-1],mna[j][j]),mnb[i][j]=min(mnb[i][j-1],mnb[j][j]);
int ans=0;
for (int i=0;i<n;i++)
for (int j=i;j<n;j++)
ans=max(ans,(j-i+1)*mna[i][j]*mnb[i][j]);
cout<<ans<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
42 ms |
54332 KB |
Output is correct |
2 |
Correct |
50 ms |
61792 KB |
Output is correct |
3 |
Correct |
44 ms |
58204 KB |
Output is correct |
4 |
Correct |
45 ms |
57048 KB |
Output is correct |
5 |
Correct |
42 ms |
51196 KB |
Output is correct |
6 |
Correct |
48 ms |
62804 KB |
Output is correct |
7 |
Correct |
46 ms |
52568 KB |
Output is correct |
8 |
Correct |
43 ms |
55632 KB |
Output is correct |
9 |
Correct |
50 ms |
62228 KB |
Output is correct |
10 |
Correct |
46 ms |
60024 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
49 ms |
62800 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
42 ms |
54332 KB |
Output is correct |
2 |
Correct |
50 ms |
61792 KB |
Output is correct |
3 |
Correct |
44 ms |
58204 KB |
Output is correct |
4 |
Correct |
45 ms |
57048 KB |
Output is correct |
5 |
Correct |
42 ms |
51196 KB |
Output is correct |
6 |
Correct |
48 ms |
62804 KB |
Output is correct |
7 |
Correct |
46 ms |
52568 KB |
Output is correct |
8 |
Correct |
43 ms |
55632 KB |
Output is correct |
9 |
Correct |
50 ms |
62228 KB |
Output is correct |
10 |
Correct |
46 ms |
60024 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
49 ms |
62800 KB |
Output is correct |
13 |
Runtime error |
235 ms |
524288 KB |
Execution killed with signal 9 |
14 |
Halted |
0 ms |
0 KB |
- |