2014多校2(1002)hdu4872
来源:互联网 发布:淘宝退货卡怎么填写 编辑:程序博客网 时间:2024/06/05 06:32
ZCC Loves COT
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 160 Accepted Submission(s): 43
Problem Description
After solves all problem of the series COT(count on a tree), ZCC feels bored and came up with a new COT problem, where letter T stands of Tetrahedron.
In this problem, Tetrahedron is define as a set of point:
T(n) = {(x, y, z) | 1≤z≤y≤x≤n}
Imagine T(n) is divided into n layers, the k-th layer contains k rows, of which the l-th row contains l points.
Moreover, we define sub-Tetrahedron a set of point, too:
sT(x, y, z, a) = {(x+i, y+j, z+k) | 0≤k≤j≤i<a}
First of all, you are given a Tetrahedron T(N), every point of T(N) has a value of 0.
Then, you should deal with M operation (Mxi, Myi, Mzi, Mai), means you should add 1 to every point’s value if it belongs to sT(Mxi, Myi, Mzi, Mai).
Then, you should deal with Q queries (Qxi, Qyi, Qzi, Qai), you should output the sum of values of points in sT(Qxi, Qyi, Qzi, Qai).
In this problem, Tetrahedron is define as a set of point:
T(n) = {(x, y, z) | 1≤z≤y≤x≤n}
Imagine T(n) is divided into n layers, the k-th layer contains k rows, of which the l-th row contains l points.
Moreover, we define sub-Tetrahedron a set of point, too:
sT(x, y, z, a) = {(x+i, y+j, z+k) | 0≤k≤j≤i<a}
First of all, you are given a Tetrahedron T(N), every point of T(N) has a value of 0.
Then, you should deal with M operation (Mxi, Myi, Mzi, Mai), means you should add 1 to every point’s value if it belongs to sT(Mxi, Myi, Mzi, Mai).
Then, you should deal with Q queries (Qxi, Qyi, Qzi, Qai), you should output the sum of values of points in sT(Qxi, Qyi, Qzi, Qai).
Input
First line: three positive integer N, M, Q.(N≤100, M≤100000, Q≤100000)
Then followed M lines, each line contains four integers Mxi, Myi, Mzi, Mai, which describe an operation.
Then followed Q lines, each line contains four integers Qxi, Qyi, Qzi, Qai, which describe a query.
Then followed M lines, each line contains four integers Mxi, Myi, Mzi, Mai, which describe an operation.
Then followed Q lines, each line contains four integers Qxi, Qyi, Qzi, Qai, which describe a query.
Output
For every query, output a line with one integer, the answer to the query.
Sample Input
2 1 21 1 1 21 1 1 22 1 1 1
Sample Output
41HintIt is guaranteed, for every sT(x, y, z, a): 1≤z≤y≤x≤x+a-1≤N.
感谢LC大神提供的题解:http://blog.csdn.net/accelerator_916852/article/details/38133849
0 0
- 2014多校2(1002)hdu4872
- hdu4872(字符串模拟)
- 2014多校1(1002)hdu4862
- 2014多校5(1002)hdu4912(贪心+LCA)
- hdu4612&多校2之1002
- 2014多校1002--hdu4961--Boring Sum
- 2014多校3(1002)hdu4888(最大流(dinic))
- 2014多校(1011)hdu4871
- HDU 4864 Task(2014多校--贪心)
- 2014 (多校)1011 ZCC Loves Codefires
- 2014多校1(1003)hdu4863
- 2014多校1(1006)hdu4866
- 多校09 1002
- HDU 5753 Permutation Bo(多校3 --- 1002)
- (2017多校6)1002/hdu-6097 Mindis(计算几何)
- 2014多校5---1002 HDU4912 ( Paths on the tree ) LCA+贪心+bfs/dfs
- 2014多校9(1007)hdu4966(最小树形图)
- 2014多校5(1008)HDU4918(点分治)
- UVA 291 The House Of Santa Claus(DFS算法)
- Android_监听自身应用被卸载
- 思科交换机 路由器配置命令大全
- stm32GPIO的复用
- 配置,编译的体会
- 2014多校2(1002)hdu4872
- hdu1823 二维线段树
- MMX Intrinsics各函数介绍
- 制作CYDIA发布源的DEB文件,详解!
- 空心三角形(2091)
- java中的printf
- 移动Android端视频通话的Java代码
- 【HDU4919】递推java大数 递归优化
- JS加载顺序