Codeforces Round #429 (Div. 1), problem: (D) Destiny Solution In C/C++
#include <bits/stdc++.h> using namespace std; const int maxN = 3e5+10, base = 1e9+7; int N, Q, ans, valmid, A; bool cmp(int x) { return x <= valmid; } struct wavelet_tree { int low, high; wavelet_tree …