You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
structSegmTree {
vector<int> T; int n;
SegmTree(int n) : T(2 * n, (int)-2e9), n(n) {}
voidUpdate(int pos, int val) {
for (T[pos += n] = val; pos > 1; pos /= 2)
T[pos / 2] = max(T[pos], T[pos ^ 1]);
}
intQuery(int b, int e) {
int res = -2e9;
for (b += n, e += n; b < e; b /= 2, e /= 2) {
if (b % 2) res = max(res, T[b++]);
if (e % 2) res = max(res, T[--e]);
}
return res;
}
};
The text was updated successfully, but these errors were encountered:
Tourist Code
The text was updated successfully, but these errors were encountered: