#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-Ofast")
#define N 200500
#define NN 205000
#define PB push_back
#define endl '\n'
#define pri(x) cout << x << endl
#define _ << " " <<
#define all(x) x.begin(), x.end()
#define sz(x) int(x.size())
#define M ll(1e9 + 7)
#define F first
#define S second
using namespace std;
//using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef short int si;
typedef unsigned long long ull;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int main()
{
ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// freopen("1.in", "r", stdin);
int n;
cin >> n;
int a[n], b[n];
for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
ll ans = 0;
for (int i = 0; i < n; i++)
{
int mna = a[i], mnb = b[i], len = 0;
for (int j = i; j < n; j++)
{
len++;
mna = min(mna, a[j]);
mnb = min(mnb, b[j]);
ans = max(ans, 1ll * mna * mnb * len);
}
}
pri(ans);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
204 KB |
Output is correct |
2 |
Correct |
5 ms |
204 KB |
Output is correct |
3 |
Correct |
5 ms |
204 KB |
Output is correct |
4 |
Correct |
5 ms |
204 KB |
Output is correct |
5 |
Correct |
4 ms |
204 KB |
Output is correct |
6 |
Correct |
5 ms |
204 KB |
Output is correct |
7 |
Correct |
5 ms |
204 KB |
Output is correct |
8 |
Correct |
5 ms |
320 KB |
Output is correct |
9 |
Correct |
6 ms |
204 KB |
Output is correct |
10 |
Correct |
4 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
5 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
204 KB |
Output is correct |
2 |
Correct |
5 ms |
204 KB |
Output is correct |
3 |
Correct |
5 ms |
204 KB |
Output is correct |
4 |
Correct |
5 ms |
204 KB |
Output is correct |
5 |
Correct |
4 ms |
204 KB |
Output is correct |
6 |
Correct |
5 ms |
204 KB |
Output is correct |
7 |
Correct |
5 ms |
204 KB |
Output is correct |
8 |
Correct |
5 ms |
320 KB |
Output is correct |
9 |
Correct |
6 ms |
204 KB |
Output is correct |
10 |
Correct |
4 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
5 ms |
204 KB |
Output is correct |
13 |
Execution timed out |
2580 ms |
1740 KB |
Time limit exceeded |
14 |
Halted |
0 ms |
0 KB |
- |