#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int n;
cin >> n;
pair<int, int> a[n+5];
for(int i = 0; i<n; i++) {
cin >> a[i].first;
cin >> a[i].second;
}
int ans = 0;
for(int i = 0; i<n; i++){
int mn1 = 1e18, mn2 = 1e18;
for(int j = i; j<n; j++){
mn1 = min(a[j].first, mn1);
mn2 = min(a[j].second, mn2);
// cout << i << " " << j << " "<< mn1 << " " << mn2 << endl;
ans = max(mn1 * mn2 * (j - i + 1) ,ans );
}
}
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
348 KB |
Output is correct |
2 |
Correct |
5 ms |
480 KB |
Output is correct |
3 |
Correct |
3 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
348 KB |
Output is correct |
5 |
Correct |
3 ms |
348 KB |
Output is correct |
6 |
Correct |
4 ms |
484 KB |
Output is correct |
7 |
Correct |
3 ms |
468 KB |
Output is correct |
8 |
Correct |
4 ms |
348 KB |
Output is correct |
9 |
Correct |
4 ms |
348 KB |
Output is correct |
10 |
Correct |
4 ms |
476 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
5 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
348 KB |
Output is correct |
2 |
Correct |
5 ms |
480 KB |
Output is correct |
3 |
Correct |
3 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
348 KB |
Output is correct |
5 |
Correct |
3 ms |
348 KB |
Output is correct |
6 |
Correct |
4 ms |
484 KB |
Output is correct |
7 |
Correct |
3 ms |
468 KB |
Output is correct |
8 |
Correct |
4 ms |
348 KB |
Output is correct |
9 |
Correct |
4 ms |
348 KB |
Output is correct |
10 |
Correct |
4 ms |
476 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
5 ms |
348 KB |
Output is correct |
13 |
Execution timed out |
2581 ms |
6076 KB |
Time limit exceeded |
14 |
Halted |
0 ms |
0 KB |
- |