摘要:        
下面是一种正确的CDQ分治,使用线段树来实现,渐进复杂度到达要求。但是貌似CDQ分治在解决偏序问题的时候要尽可能使用树状数组。小心不要把i和j写反了。下面这个写法虽然没有WA,但是TLE了,这个非常麻烦。事实上是因为有很多多余的操作影响了常数,比如多余的排序、没有用的修改、询问。当然这个线段树也可以    阅读全文
posted @ 2019-09-05 20:32
Inko
阅读(169)
评论(0)
推荐(0)
        
            
        
        
摘要:        
https://www.acwing.com/problem/content/201/ 要注意这次的数论分块里面是有一个上界n的,对k进行分块的时候l和r都不能超过n。 cpp include using namespace std; typedef long long ll; ll s1(ll n    阅读全文
posted @ 2019-09-05 17:44
Inko
阅读(139)
评论(0)
推荐(0)
        
            
        
        
摘要:        
https://www.acwing.com/problem/content/258/ cpp include using namespace std; typedef long long ll; const int N = 600010; int trie[N 24][2], latest[N 2    阅读全文
posted @ 2019-09-05 17:22
Inko
阅读(117)
评论(0)
推荐(0)
        
            
        
        
摘要:        
``` include define mid ((l+r) 1) using namespace std; typedef long long ll; const int MAXN = 200000 + 5; int T[MAXN], tcnt; int cnt[MAXN cnt[v] cnt[u]    阅读全文
posted @ 2019-09-05 16:55
Inko
阅读(97)
评论(0)
推荐(0)
        
 
                    
                
 浙公网安备 33010602011771号
浙公网安备 33010602011771号