1000 bucket contains two bucket of toxic Liquor

Source: Internet
Author: User

The following problems are provided in the link:

The king prepared 1000 barrels of wine for his birthday banquet after 10 days. Unfortunately, two of them were poisoned. In order to determine the two barrels of liquor, some people proposed to try the drugs with the death penalty. The incubation period is 10 days.
Q: How many prisoners are required to find out the drugs? How is the solution implemented?


This question seems to be a simple extension of the problem where one bucket of Liquor contains one bucket of liquor, but in fact it is much more difficult than a bucket of liquor.


Using information theory, it is easy to obtain that at least 19 dead prisoners are needed to find out all the poisonous wines, but this is just a rough lower bound.


Solution 1: link 7 # the hexagonal cocktail diagram allows 6a + 3 prisoners to recognize 3A ^ 2 + 3A + 1 bucket (up to two bucket of toxic liquor)



Solution 2: the constant-weight code uses some existing results to produce a solution for 41 prisoners to solve 1095 barrels of liquor (exactly two barrels of toxic liquor)

Where: A (n, D, W) indicates the maximum number of elements in the set with a length of N bits. The number of different bits of any two elements in the set is not less than D, each binary number has exactly W bits of 1.
For the scheme (W is an odd number) in a (n, W + 1, W), if the number of two bits 1 is the binary number of W, there must be at least W + 1 at different positions; that is, the same bit 1 max (W-1)/2. in this question, let a (n, W + 1, W) bucket Let N prisoners drink, N bits correspond to N prisoners respectively. each binary number corresponds to a bucket of wine. for each binary number, the prisoner corresponding to bit 1 needs to drink the corresponding wine.
If a bucket of wine is toxic, the corresponding binary number of all the prisoners corresponding to bits 1 will inevitably die. if a bucket of wine is not toxic, then because there are only two barrels of toxic wine, so the corresponding binary number has a maximum of 2*(W-1)/2 = W-1 prisoner died.
That is to say, we can determine whether the wine is toxic Based on the binary number corresponding to a barrel of wine.


Link 25 # gives an upper bound of complexity O (log ^ 2 (n), and link 30 # Shows method 2. complexity O (log (N) can be reached when n is sufficient )), so it is a very good method.


Solution 3: Union-free hypergraphs and probability theory solves the problem of 2 ^ n barrels of wine by using a structure of 2 ^ n Finite Groups, thus, 40 prisoners were used to solve the solution of 1024 barrels of liquor (exactly two barrels of liquor)


Solution 4: it is surprising that Google has found a probability method that can be optimized to 33 prisoners. the attachment in the Link provides a solution for 33 prisoners and 34 prisoners to solve the problem of 1000 barrels of liquor (two barrels of liquor)


Link 65 # search by computer to find out some optimal solutions with a relatively small number of buckets. It is concluded that when the number of prisoners does not exceed 5, only n + 1 bucket can be identified, and 6 people can recognize 8 buckets, identify 10 buckets for 7 persons.

While 8 people can identify 13 barrels (but do not know whether it is the best, more people can not ensure the best), 9 people 16 barrels, 10 people 20 barrels, 11 people 26 barrels, 12 persons: 32 barrels, 13 persons: 39 barrels, 14 persons: 47 barrels


Solution 5: but I didn't expect tannis_jin to improve the solution by providing the class scheme. in fact, for example, in the hexagonal diagram in solution 1, we can divide the problem into three different groups of 2a + 1 cocktail schemes for each group, among them, 2a + 1 type of cocktail is one or two of which are problems of drug identification. for this 2a + 1 cocktail, we don't need 2a + 1 prisoner, but only need H (2a + 1) people, where H (2a + 1) it is the minimum number of people who can identify the situation where 2a + 1 bucket contains a maximum of two bucket toxic wines. for example, H (12) <= 8, H (15) <= 9, H (19) <= 10, H (25) <= 11, H (31) <= 12, H (46) <= 13 so we get 3 h (2a + 1) People can recognize 3A ^ 2 + 3A + 1 bucket. therefore, according to the H (46) <= 13 searched by the computer, 39 people can recognize 1519 barrels of wine.


Solution 6: In 73 # tannis_jin, it is further pointed out that the square scheme can be better than the hexagonal scheme, so a ^ 2 bucket wine only needs 2 H () + H ([A/2]) prisoner. 74 # For this purpose, we searched 12 people by computer and found a solution for 12 people to identify 33 barrels of liquor (including two barrels of liquor) or 32 barrels containing up to two barrels of liquor. then we get h (32) <= 12

Therefore, 1024 barrels of wine only need 2 H (32) + H (16) <= 2*12 + 10 = 34 prisoners. among them, H (16) is very likely to reach 9, but now the computer has not searched out (9 prisoners can find 16 barrels of wine that exactly contain two barrels of poison wine, however, if two or one bucket of toxic liquor is found in 16 barrels, the search is not successful ). that is, 34 prisoners identified 1024 barrels of liquor (two of which are poisonous wines)

Similarly, tannis_jin expanded the square scheme to a 10*10*10 cube scheme, and obtained a 34 prisoner scheme. this solution may also be improved (mainly in the diagonal line recognition), that is, 34 people identify 1000 barrels of wine (exactly two barrels of toxic wine ).


So far, the best solution we have found is to solve the problem of 1000 bucket containing two bucket of toxic Liquor by 33 prisoners using the Probability Method in solution 4, the sub-optimal solution is the 34 prisoners that can be obtained in solution 6. of course, we still cannot know what the optimal solution is. We can determine that the range is between 19 prisoners and 33 prisoners.





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.