Code Benders

can anyone solved


I think there is pattern but can get it complete
pattern of 1,10,11,100,101,110,111,1000…etc.
many are repeated too?

and please explain https://www.codechef.com/CBEN2020/problems/RESVATK
problem statement ,how Reservoir is connected to house,and test case too?

First condition states that there cannot exist a component in which only houses are connected.
Second condition tells that the sum of Ai of all houses and reservoir present in the component must be negative.
Can anyone explain the logic ,how can we solve the problem??

1 Like

but why there is line written like

Remove the pipe between 1 and 4.

it should be

Remove the pipe between 3 and 4.

There is no edge present between 3 and 4.

Note: We have to remove minimum edge so that condition is satisfied.