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…
Pinball Game 3D Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1137 Accepted Submission(s): 477 Problem Description RD is a smart boy and excel in pinball game. However, playing common 2D…
bobo has a tree, whose vertices are conveniently labeled by 1,2,…,n. At the very begining, the i-th vertex is assigned with weight w i. There are q operations. Each operations are of the following 2 types: Change the weight of vertex v into x (denote…
Apple Tree Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 26762 Accepted: 7947 Description There is an apple tree outside of kaka's house. Every autumn, a lot of apples will grow in the tree. Kaka likes apple very much, so he has been…
C. Propagating tree Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/383/problem/C Description Iahub likes trees very much. Recently he discovered an interesting tree named propagating tree. The tree consists of n nodes numb…