#include <bits/stdc++.h>
#define ST first
#define ND second
#define PB push_back
using namespace std;
using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;
const int nax = 2000 + 10, INF = 1e9;
int a[nax], b[nax], n;
ll ans;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for(int i = 0; i < n; ++i) {
cin >> a[i] >> b[i];
}
for(int l = 0; l < n; ++l) {
int A = INF, B = INF;
for(int r = l; r < n; ++r) {
A = min(A, a[r]);
B = min(B, b[r]);
ans = max(ans, (ll)A * B * (r - l + 1));
}
}
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
204 KB |
Output is correct |
2 |
Correct |
6 ms |
332 KB |
Output is correct |
3 |
Correct |
4 ms |
204 KB |
Output is correct |
4 |
Correct |
4 ms |
324 KB |
Output is correct |
5 |
Correct |
4 ms |
204 KB |
Output is correct |
6 |
Correct |
5 ms |
204 KB |
Output is correct |
7 |
Correct |
4 ms |
332 KB |
Output is correct |
8 |
Correct |
4 ms |
204 KB |
Output is correct |
9 |
Correct |
4 ms |
204 KB |
Output is correct |
10 |
Correct |
4 ms |
328 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
6 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
204 KB |
Output is correct |
2 |
Correct |
6 ms |
332 KB |
Output is correct |
3 |
Correct |
4 ms |
204 KB |
Output is correct |
4 |
Correct |
4 ms |
324 KB |
Output is correct |
5 |
Correct |
4 ms |
204 KB |
Output is correct |
6 |
Correct |
5 ms |
204 KB |
Output is correct |
7 |
Correct |
4 ms |
332 KB |
Output is correct |
8 |
Correct |
4 ms |
204 KB |
Output is correct |
9 |
Correct |
4 ms |
204 KB |
Output is correct |
10 |
Correct |
4 ms |
328 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
6 ms |
332 KB |
Output is correct |
13 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
14 |
Halted |
0 ms |
0 KB |
- |