Data Structures, Algorithms, Leetcode, Segment Tree, Programming.
a bitset, where each node represents the range of values from 1 to 100 that it covers. bitset<101> sum[4 * N]; void push_up(int rt) { sum[rt] = sum[rt * 2] | sum[rt * 2 + 1]; } void build(vector<int> &A, int rt, int L, int R) { if (L == R) sum[rt].set(A[L]); // sum[rt] is a node that governs A[L],