题目链接 Solution 主席树水题,连差分的部分都不需要用到. 直接用主席树的结构去存一下就好了. Code #include<bits/stdc++.h> #define mid (l+r)/2 using namespace std; const int maxn=2000008; int T[maxn],tot,n,m; int ch[maxn*10][2]; int a[maxn],id[maxn]; int w[maxn*10],num; int read() { char ch…
D-query Time Limit: 227MS Memory Limit: 1572864KB 64bit IO Format: %lld & %llu Submit Status Description English Vietnamese Given a sequence of n numbers a1, a2, ..., an and a number of d-queries. A d-query is a pair (i, j) (1 ≤ i ≤ j ≤ n). For e…