4630专题

hdu 4630 树状数组+离线操作+GCD

http://acm.hdu.edu.cn/showproblem.php?pid=4630 重新认识了树状数组。 首先要记住那个树形的图,然后+或-lowbit(i)是自己根据具体问题设定的,不要死于+或者-, 树状数组的特点: 1、+lowbit(i)可以到达包含结点i的上一层父节点    所以用于值的更改 2、-lowbit(i)可以到达不包含i所代表区间的上一层父节点  所以用于值

No Pain No Game HDU - 4630(gcd+线段树+离线处理)

Life is a game,and you lose it,so you suicide. But you can not kill yourself before you solve this problem: Given you a sequence of number a 1, a 2, …, a n.They are also a permutation of 1…n. You need