If we use simple Fenwick tree for finding sum, and every element of initial array is 0 or 1, and we have 2 type of queries:
1) replace given "1" to "0" value (and only 1->0 replacements, so, count of "1" decreases every time)
2) find position of K-th "1" in the array
So, "1)" could be done in O(log2(N)), and what about "2)"?
How to make second query in O(log2(N)) time too, not in O(log2(N)^2) ?