You are the ruler of a great empire and you have decided to throw another celebration tomorrow. However, apparently you were forgetful of the near disaster that happened in the last celebration, and decide to hatch your own plan with poison. For during this celebration, one of your most hated rivals will come, thinking that you have finally given up your fight and you held this celebration in part to surrender to your rival's superiority. You decide to pour some drops of that same deadly poison (that have no symptoms except death 10 to 20 hours later) into his glass; however, you do not want to look guilty, so to push the blame away you will insert some poison in your own drink that will make you sick after 10 to 20 hours with some worrisome but definitely non-lethal symptoms.
You have already inserted the deadly poison in one glass and your non-lethal poison in another glass out of the 1000 glasses, but because of your forgetfulness you forgot which glasses had the poisons! Certainly, you don't want another one of your beloved guests to drink a poisoned glass, or even worse, giving yourself the lethally poisoned glass.
Fortunately, you still have your supply of death-row prisoners who you are sure won't mind lending a helping hand by taste-testing the glasses. What is the least amount of prisoners needed to guarantee successful location of the lethally and non-lethally poisoned glasses?
Note: if the lethal poison acts before the non-lethal poison, the prisoner will die without any symptoms.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
I think the flaw is in assuming you only need 4 prisoners to identify the position in an axis of both poisons (the lethal and the non-lethal), that would be enough for 1 poison, but I don't think it would be enough for both. According to the theoretical answer Daniel posted, you would need 7 prisoners for each axis (to identify one of the 90 possible combinations of the 2 poisons).
Log in to reply
Remember that the 2 poisoned glasses can never be on the same set of 3D coordinates. Even if the 2 poisoned glasses happen to be contained in the same 2D axes, the third dimension will settle the issue.
Log in to reply
Think of this example: 12 prisoners are assigned to test the wine glasses, 4 for each coordinates. Let's name them A1, A2, A3, A4, B1, B1, B2, B3, B4, and C1, C2, C3, C4.
After about 14 hours, prisoners A1, A2, A3, B2, C2 and C4 suddenly die. A couple hours later, prisoners B3 and C3 start getting sick, but after the 20 hours they don't die.
With this information you now for sure that A1, A2, A3, B2, C2 and C4 drank the lethal poison and this will give you the exact coordinates for that glass.
But you still have many options for the position if the glass with the non-lethal poison, as any prisoner who died may have drank from both poisons or just from the lethal one. Let's just focus on the first coordinate, and we have 8 possibilities:
Which means there isn't enough information to locate the glass with the nonlethal poison, even if you knew the other 2 coordinates.
Hmm, this is interesting... I'll have to look into it.
We can easily locate the poisoned glass using just 10 prisoners. You surely don't support abolition of death penalty :P
For every single prisoner, it seems like we can get maybe two bits of information: whether the non-lethal glass is in a subgroup, and whether the lethal glass is in a subgroup.
However, I will prove to you that each prisoner will supply at most one bit of information using induction.
Let the lethal glass be L and the non-lethal glass be N .
The base case: the first prisoner chooses a set S 1 of glasses. Worst case scenario, L ∈ S 1 , so he might die without showing symptoms and it will give us one bit of information.
Now consider the intersections S n = L ∈ S i ⋂ n S i If S n + 1 ∩ S n = ∅ then we know that L ∈ S n + 1 so we can get at most one bit of information about whether N is or is not in S n + 1 .
If S n + 1 ∩ S n = ∅ then there is a possibility that L ∈ S n + 1 so we get only one bit of information, whether prisoner n + 1 will or will not die.
Thus, we get at most one bit of information per prisoner. The number of ways to arrange a lethal glass and a non-lethal glass in 1 0 0 0 glasses is 1 0 0 0 ∗ 9 9 9 = 9 9 9 0 0 0 and since ⌈ lo g 2 9 9 9 0 0 0 ⌉ = 2 0 we need at least 2 0 bits of information to determine the glasses. Thus the answer is 2 0 prisoners.
Is the ruler too poor to pour out another 1000 glasses of wine?
Log in to reply
Haha, never thought of that before.
But what if you don't have any more poison left? ;)
Log in to reply
I dont understand how can u get poisionus glasses with 20 since the celebration is tomorrow. It will take 10-20 hours to check 1 glass. Techinally, u will need 1000 prisoners and since only 1 dies so u can say that u only used 1 as another 999 lived.
Log in to reply
@Hetav Panchani – Remember that a prisoner can drink more than one glass. Moreover, if multiple prisoners drink a certain number of glasses, then 10 to 20 hours later, they will either die, be poisoned, or stay healthy; from this information, we can determine which the poisoned glasses are.
I just realized that the method I posted for testing doesn't actually work. Can you find a method that does?
Replying to Challenge Master note:
I could have been even more tricky by offering 1448 glasses of wine. However, by now it is very much an edge case, so even though theoretically the answer should be 21, finding a strategy that will make it work becomes a lot harder. The strategy I commented below could do it in 22 moves.
My answer is 18
Log in to reply
If you have just over 30 hours till the party, I agree with 18. If you have less time, and we must know by the party, then 20 would still be correct.
[Replying to Challenge Master note]
Even 1025 glasses of wine can be handled with 20 prisoners. The scheme presented by Piyush Ravi, which uses 20 prisoners for 1024 wine glasses (a so-called dual-rail code), can be extended by 1 glass from which no prisoner drinks. This scheme still works. If no prisoners die, then the 1025th glass had the deadly poison. If at least one prisoner dies, but no prisoners gets sick, then the 1025th glass was sickening. Otherwise, proceed as before.
Log in to reply
Are you able to figure out the maximum number of wine glasses with 20 prisoners? If so, how can we substantiate it?
Log in to reply
@Calvin Lin - I haven't given that much thought. But I would think that 1025 is the maximum. I don't think that the scheme I gave for 1025 glasses allows any additional glasses. Such a glass would need a fresh combination of 20 prisoners (there are still plenty of those), but it should be such that when any glass has the deadly poison, and the prisoners who drank from that glass are eliminated, then the remaining combinations for the remaining glasses are still unique. Hence, we cannot have a combination where 11 or more prisoners drink from a glass. Because then you would have only 9 or fewer prisoners left. And we cannot have 1024 different combinations.
By the way, if 20 prisoners suffice for 1025 glasses, then apparently you extract (a little) more than 1 bit per prisoner. So, I am afraid your argument that the minimum number of prisoners needed is 20, has a flaw. (Again, I haven't tried to pinpoint it.)
A method of achieving 2 0 prisoners:
Apply the strategy of the linked problem, which gives 1 0 prisoners needed, to find the lethal glass. Having singled out the lethal glass, it takes 1 0 more prisoners to single out the non-lethal glass, giving a total of 2 0 prisoners used.
EDIT: this method actually does not work because we need the results of the first test for the second one. However, my solution proves that there does exist a solution. Perhaps someone can try to find it.
Log in to reply
Lets label all the glasses from 0 to 999 in binary: i.e. from 0000000000 to 1111100111 Now have one prisoner drink from all the glasses having 1 at the first position. Have another one drink from all the glasses having 1 at the second position and so on; with this 10 prisoners, we will identify the lethal glass.
Simultaneously, have another 10 to do the same thing but with positions having 0 instead of 1. This will help us locate the non-lethal glass.
If at nth position lethal and non-lethal glasses have same number, 0 or 1, then prisoners drinking from glass having that bit will die with or without showing any symptoms but prisoners who drank from glasses having another bit will remain healthy thus showing that lethal and non-lethal glass at that position have same bit.
On the other hand if at nth position the glasses have different number, then it's quite simple to deduce which number belong to lethal and non-lethal glasses.
And we will get our answer at most within 20 hours.
this doesn't work. let's try to apply it to three glasses. using your solution we would arrive at the answer of 3 prisoners it can be shown that we only need 2. say prisoner A drinks glass 1, prisoner B drinks glass 2 if A dies and B gets sick, we get L=1, N=2 if A dies, we get L=1, N= 3 if A gets sick and B dies, we get L=2, N=1 if A gets sick, we get L=3, N=1 if B gets sick, we get L=3, N=2 that's all 6 combinations with more than 1 bit of information from each prisoner
i believe the more appropriate formula would be ceiling(log 2 (n)) + ceiling(log 2 (n-1)), where n is the number of glasses
This proves that 20 prisoners are sufficients. But it is absolutely not a proof that 20 prisoners is the optimal solution to determine the lethal and non-lethal glasses.
Why can't you have one prisoner drink until he dies or gets sick, remove the bad glass. Have a 2nd prisoner drink till the second glass is found?
Log in to reply
You only have one day to find the poisoned glasses, since the party is tomorrow.
Start the experiment @12am if one prisoner drinks a glass they will either be alive or dead by the earliest at 10am.....assuming the hint to be true. If alive they can then drink another glass to find out if they're alive or dead by 8pm
Too many possible answers...... The problem never states how many glasses each prisoner can drink. Not to mention the hint at the end!
Log in to reply
Since you are trying to guarantee finding the poisons, you should always assume worst-case scenario.
Let's do some mind experiment.
As you are probably familiar, you need 10 prisoners to find only the lethal-poisoned glass. To solve this using a binary system, you can feed the first prisoner glass number 1, second prisoner glass number 2, first and second prisoner glass number 3, and so on.
The mental stretch comes here. Imagine making 1000 groups of 999 glass. First group has all but glass number 1, second group has all but glass number 2, etc.
Out of those 1000 groups, there will be exactly one group of 999 glasses that has non-lethal poison but does not have lethal poison. From that group, you can find the non-lethal poisoned glass. 999 to check for, so you need 10 prisoners account all possibilities using the same tactic you use for the simpler version of the question. Now the second part is finding which group of 999 glasses was the one that contained the non-lethal glass but not the lethal glass. There are 1000 of such groups. Since we need to find 1 of 999 out of 1000, we need to count for 999000 possibilities. Closest power of 2 that is greater than 999000 is 2^20, which is approximately 1 million.
Therefore, we need 20 prisoners.
Label the glasses in binary numbers. To determine the lethal poison, ask the first prisoner to try all glasses with first number 1, second prisoner to try all glasses with second number 1, etc. Then you can determine which one is deadly by which prisoners are dead. Nine won’t work, since you can only form 2^9=512 combinations but ten can form 2^10=1024 combinations. Also, you need to locate the non-lethal poison and there is no way to test both the deadly one and the non-lethal one at the same time. Therefore you need another 10 prisoners, total 10+10=20 prisoners.
Problem Loading...
Note Loading...
Set Loading...
We answered 20 but we happened to device a testing method that can locate both the poisoned glasses out of 1000 using only 12 prisoners
First, we arranged the 1000 glasses in a 10x10x10 cube. Each glass will have a unique set of 3D coordinates. Instead of placing 10 prisoners per axis, we decided to take combinations from 4 prisoners to cover all 10 positions per axis (since 3 prisoners can only cover at most 7 coordinates). Therefore, based on which set of prisoners die or get sick, we can locate the poisoned glasses from their coordinates.
We still haven't found the flaw in either this testing method or the theoretical solution posted.
(solution created with Alen Balbuena)