现在有一个长度为 5×1055 \times 10^55×105 的数组 aaa(aaa 中的数 ≤5×105\le 5 \times 10^5≤5×105),有 5×1075 \times 10^75×107 次操作(假设不考虑输入的时间),每次操作查询一个区间 [l,r][l,r][l,r] 中数 xxx 出现了多少次。
这个问题我只会对于每个数记录下标放到 vector 然后二分,但是时间炸了,求复杂度小于 O(mlogn)\mathcal O(m\log n)O(mlogn)(n=5×105,m=5×107n=5 \times 10^5, m=5 \times 10^7n=5×105,m=5×107)的思路。
另外分块仿佛不行,因为空间限制是 50 MB50\,\text{MB}50MB。