Hello there I'm trying to solve this problem I'm keeping a persistent segment tree from end to begin for the cnt[] array which keeps the number of results of indexes so far and then for each elemnt in array i query on the tree next to the number and get how many indexes with smaller results Here is mysubmission is 10^6 too much for a persistent segment tree, or am i doing something wrong ? Thanks in advance :D