#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
int n;
cin>>n;
vector<pair<int,int>>histo(n);
for (int i=0; i<n; i++) cin>>histo[i].first>>histo[i].second;
long long int ans=0;
for (int i=0; i<n; i++){
int x=histo[i].first, y=histo[i].second;
for (int j=i; j<n; j++){
if (histo[j].first<x) x=histo[j].first;
if (histo[j].second<y) y=histo[j].second;
ans=max(ans, (long long int)x*y*(j-i+1));
}
}cout<<ans<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
344 KB |
Output is correct |
2 |
Correct |
6 ms |
212 KB |
Output is correct |
3 |
Correct |
5 ms |
212 KB |
Output is correct |
4 |
Correct |
5 ms |
212 KB |
Output is correct |
5 |
Correct |
5 ms |
312 KB |
Output is correct |
6 |
Correct |
6 ms |
336 KB |
Output is correct |
7 |
Correct |
6 ms |
308 KB |
Output is correct |
8 |
Correct |
6 ms |
212 KB |
Output is correct |
9 |
Correct |
6 ms |
212 KB |
Output is correct |
10 |
Correct |
6 ms |
328 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
6 ms |
308 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
344 KB |
Output is correct |
2 |
Correct |
6 ms |
212 KB |
Output is correct |
3 |
Correct |
5 ms |
212 KB |
Output is correct |
4 |
Correct |
5 ms |
212 KB |
Output is correct |
5 |
Correct |
5 ms |
312 KB |
Output is correct |
6 |
Correct |
6 ms |
336 KB |
Output is correct |
7 |
Correct |
6 ms |
308 KB |
Output is correct |
8 |
Correct |
6 ms |
212 KB |
Output is correct |
9 |
Correct |
6 ms |
212 KB |
Output is correct |
10 |
Correct |
6 ms |
328 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
6 ms |
308 KB |
Output is correct |
13 |
Execution timed out |
2544 ms |
4528 KB |
Time limit exceeded |
14 |
Halted |
0 ms |
0 KB |
- |