I missed out on this May contest and was keen to solve the problems but I got stuck on this one.
Here is my solution -
seems to be right till the very end ! still no AC yet :
I appreciate your effort to look into this thanks !!
Are you sure there are no overflows there? Try using a larger datatype.
I tried LLU but it gave SIGSEGV error.
I just cant see whats wrong :
Is there some error with the algo ?
Most of them have got the answer using Double so I dont see why that should be a problem
The algo seems to be correct, I just skimmed through it. You can just verify that from the editorial. I will try to find the error in your solution if possible. I tried changing a couple of things in your code and I got SIGSEGV too.