머지소트트리
int arr[100002]; vector tree[4 * 100002]; int N, M, K; void update(int bucket, int start, int end, int node, int x) { if (node < start || end < node) return; tree[bucket].push_back(x); if (start != end) { update(bucket * 2, start, (start + end) / 2, node, x); update(bucket * 2 + 1, (start + end) / 2 + 1, end, node, x); } } int query(int node, int start, int end, int left, int right, int x) { if ..