For example if you only have 1 pig, 45 buckets, pigs will die after 15minutes and 1 hour.
feed the pig with bucket 0 at 0:00
feed the pig with bucket 1 at 0:01
feed the pig with bucket 2 at 0:02
feed the pig with bucket 44 at 0:45
if pig dies at 0:15 then bucket 0 is poisonous
if pig dies at 0:16 then bucket 1 is poisonous
if pig dies at 0:17 then bucket 2 is poisonous
if pig dies at 1:00 then bucket 44 is poisonous
In this setup we can find out the poisonous buckets among 45 with only 1 pig in 1 hour.
Further more, if we can measure the accuracy of the pigs dying time to second, then it is a totally different answer.
I know what you would like the problem to be, but it will be nice if this can be clarified in the problem description, like "you can only feed the pigs every m minutes", etc.
'cause the condition is just "pigs die within m minutes after poisoned", we don't know the exact time when the pig will die. In case of the poison being mixed with water, we can only feed the pigs every m minutes.
I think this needs clarification as well, I still was not sure what the actual problem was after reading and had to come here for more explanation. With the current restrictions one pig can solve any number of buckets as long as m is less than the total time.
@briansrls said in The problem does not clarify any restriction on when to feed the pigs:
With the current restrictions one pig can solve any number of buckets as long as m is less than the total time.
Not like AdamCe proposed, because as zonegrave already pointed out, we only know "within m minutes". Maybe it takes the full m minutes, maybe it only takes one second. You don't know.
@StefanPochmann You're right, for some reason I interpreted this as "in 15 minutes". Thanks for the clarification.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.