Tree Array of Algorithm Templates (HDU 1166 Enemy Array)

Hits: 0//Tree array // O(logn) // HDU 1166 enemy formation const int maxn = 100000 ; int Tree[maxn+ 10 ]; int lowbit ( int x ) { return (x&-x); } void add ( int x, int value ) //Add a number to A[i] { for(int i = x; i <= maxn; i += lowbit(i)) Tree[i] …

Tree Array of Algorithm Templates (HDU 1166 Enemy Array) Read More »