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.
11605 - Lights inside a 3d Grid
Moderator: Board moderators
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11605 - Lights inside a 3d Grid
You can solve each test case in O(N * M * P)
Check input and AC output for thousands of problems on uDebug!
Re: 11605 - Lights inside a 3d Grid
I got the idea of the closed form. thanks to Jacob from codeforces
thanks anyways.
thanks anyways.