Page 1 of 1

Re: 11605 - Lights inside a 3d Grid

Posted: Thu Oct 30, 2014 5:39 pm
by sanzeee
to solve this problem i derived the following equation for a single light bulb:
Let p is the probability of selecting the light.
So the expectation for the light will be sum over i(1 to k) : p^i * (1-p)^(k-i). Now we only need to add the terms where i is odd as only then the light will be ON.
calculating this for all the bulb is obviously time out :( :( :(
is there any close form? i can't find it :( :( :(

thanks in advance.

Re: 11605 - Lights inside a 3d Grid

Posted: Thu Oct 30, 2014 11:48 pm
by brianfry713
You can solve each test case in O(N * M * P)

Re: 11605 - Lights inside a 3d Grid

Posted: Wed Nov 05, 2014 7:23 am
by sanzeee
I got the idea of the closed form. thanks to Jacob from codeforces

thanks anyways.