이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define F first
#define S second
#define ALL(x) x.begin(), x.end()
#define MEM(x) memset(x, 0, sizeof(x))
#define MEMS(x) memset(x, -1, sizeof(x))
#define eb emplace_back
#define ep emplace
#define mkp make_pair
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
/*------------------------------------------------------------------*/
const int N = 2005;
ll a[N], b[N];
inline void solve() {
int n; cin >> n;
for(int i = 0; i < n; ++i)
cin >> a[i] >> b[i];
ll ans = 0;
for(int i = 0; i < n; ++i) {
ll x = a[i], y = b[i];
ans = max(ans, x * y);
for(int j = i + 1; j < n; ++j) {
x = min(x, a[j]), y = min(y, b[j]);
ans = max(ans, x * y * (j - i + 1));
}
}
cout << ans << '\n';
}
int main() {
cin.tie(0), ios::sync_with_stdio(0);
solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |