Need help with SHIVIGOD problem

Hi what is wrong with this O(N(B-A)) time complexity solution? Is the test case wrong?
Basically I am using a hash map to store the sum and computing the average on the fly.
What is wrong with this? Please help

https://www.codechef.com/viewsolution/40454208

As we have to display answer till 6 decimal places. So use
cout<<fixed<<setprecision(6); before printing answer.

1 Like

Thank you very much that worked!!