I'm solving one problem from past competitions in programming, so i need help, i will explain the problem in one sentence. You have an array with size of N, where N can go up to 10^5. And then in second line you have exactly N elements. So now you have to count the the ways to pick three elements from the array such that they will be in decreasing order. Here is example
N=4 and the array looks like this 190, 180, 170, 168. We have exactly four ways to pick those three elements. 1. (190, 180, 170) 2. (190,180,168) 3. (190, 170, 168) and 4. (180, 170, 168)
I think that this should be solved with segment tree but i don't know with which argument should i create the tree. Thanks in advance.