BZOJ_2253_[2010 Beijing wc]纸箱堆叠 _CDQ分治+树状数组 Description P 工厂是一个生产纸箱的工厂.纸箱生产线在人工输入三个参数 n p a , , 之后, 即可自动化生产三边边长为 (a mod P,a^2 mod p,a^3 mod P) (a^4 mod p,a^5 mod p,a^6 mod P) .... (a^(3n-2) mod p,a^(3n-1) mod p,a^(3n) mod p) 的n个纸箱.在运输这些纸箱时,为了节约空间,必须将…
每个时刻都形成若干段满足段内任意两点可达.将其视为若干正方形.则查询相当于求历史上某点被正方形包含的时刻数量.并且注意到每个时刻只有O(1)个正方形出现或消失,那么求出每个矩形的出现时间和消失时间,就是裸的三维偏序,cdq分治+树状数组即可. #include<bits/stdc++.h> using namespace std; #define ll long long #define inf 1000000010 #define N 300010 #define mp(x,y) make_…
Problem Description RD is a smart boy and excel in pinball game. However, playing common 2D pinball game for a great number of times results in accumulating tedium. Recently, RD has found a new type of pinball game, a 3D pinball game. The 3D pinball…