Hii…
I am upsolving this question from codeforces last day contest…
https://codeforces.com/contest/1461/problem/C
My logic is…
First i have collected only those probabilities in vector v1…by which array can be sorted…
I have also collected probabilies when we don’t perform that action in v2…
Now i checked if array is already sorted then i printed 1.0
Else i have used the first probaility in vector v1…
and for all the remaining probailies i have first calculated the probailites of missing all of the remaining probailites and multiplied with the current probability.
Now in this way i printed the ans.
It is O(n) solution.
Don’t know why it is showing it is showing TLE.
https://codeforces.com/contest/1461/submission/100987701
Please Check This.
Thanks.