Getting Tle on test case - 9

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.

Hello @ashishnnnnn just for your knowledge i want you to know that codeforces demands more optimised solution.
because test cases are very large.

Yaa…

I know and that thing i can learn only by doing question in wrong way and then correcting the mistakes.
Hope you understand… :slight_smile:

Yes i understand!
i suggest you to wait for the editorial once it comes then you can try that and raise the doubt again if you didnt get them.

I also do the same…

For this i have seen video editorial and without seeing the code… I have tried to implement it on my own…

please share that editorial and code link with me.
i will see and tell you.

This is the link of that editorial Video…

and this is his code…
https://codeforces.com/contest/1461/submission/100944316

I got where i was doing wrong…
Actually that was n**2 approch…
This is the accepted solution…
https://codeforces.com/contest/1461/submission/100999337
Thanks

If possible… Just see the yeaterday D.P question…
I tried to debug today also but failed.
Thanks

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.