#include <bits/stdc++.h>
#define i2 array<int,2>
using namespace std;
typedef long long ll;
const int N = 200100;
const int oo = 2e9;
deque<int> pref[N], suf[N];
int n, a[N], b[N], pre[N], nm[N], rt[N], lf[N];
ll ans = 0;
bool cmp(int _x, int _y){
return a[_x] > a[_y];
}
int get(int x) { return (pre[x] == x ? x : pre[x] == get(pre[x])); }
ll link(int fi, int se){
int FI = get(fi);
int SE = get(se);
ll res = 0;
// if (rt[FI] - lf[FI] > rt[SE] - lf[SE]){
for (int it = 0; it < sz(pref[SE]); it++){
int i = pref[SE][it];
{
// smallest in FI
int l = 0, r = sz(suf[FI]);
while (l < r){
int md = (l + r) >> 1;
if (b[suf[FI][md]] > )
}
if (l > 0){
}
}
{
// smallest in SE
}
}
// pre[SE] = FI;
// rt[FI] = max(rt[FI], rt[SE]);
// lf[FI] = min(lf[FI], lf[SE]);
// link deqs
// } else {
// }
return res;
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL
freopen("in.txt","r",stdin);
#endif // _LOCAL
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i] >> b[i];
nm[i] = i;
pre[i] = -1;
}
sort(nm, nm + n, cmp);
for (int it = 0; it < n; it++){
pre[i] = rt[i] = lf[i] = i;
pref[i].clear();
suf[i].clear();
pref[i].push_back(i);
suf[i].push_back(i);
ans = max(ans, ll(a[i]) * ll(b[i]));
if (i > 0 && pre[i - 1] >= 0)
ans = max(ans, link(i - 1, i) * ll(a[i]));
if (i + 1 < n && pre[i + 1] >= 0)
ans = max(ans, link(i, i + 1) * ll(a[i]));
}
cout << ans;
return 0;
}
Compilation message
histogram.cpp: In function 'll link(int, int)':
histogram.cpp:24:31: error: 'sz' was not declared in this scope; did you mean 'se'?
24 | for (int it = 0; it < sz(pref[SE]); it++){
| ^~
| se
histogram.cpp:34:42: error: expected primary-expression before ')' token
34 | if (b[suf[FI][md]] > )
| ^
histogram.cpp:35:17: error: expected primary-expression before '}' token
35 | }
| ^
histogram.cpp:25:17: warning: unused variable 'i' [-Wunused-variable]
25 | int i = pref[SE][it];
| ^
histogram.cpp: In function 'int main()':
histogram.cpp:77:13: error: 'i' was not declared in this scope; did you mean 'it'?
77 | pre[i] = rt[i] = lf[i] = i;
| ^
| it