|
||||||||||
How many people have ipad IITime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 342 Accepted Submission(s): 149 Problem Description hh found more and more of his friends are having ipad IIs. One day when they get together, hh asked his five friends, "How many of you have ipad II now?" "One!" "Three!" "Everyone!" "Four!" "Two!" hh's friends knew each other. They were clear about the "how many" question, while the answers are different, so there must be some people telling lies. One of hh's friends told him(hh): number of people, who had ipad IIs, and lied, was no more than 1. number of people, who didn't have ipad IIs, and told the truth, was no more than 2. at least one people have ipad II. Given the information, hh realized there may be one or two people having ipad IIs. Now hh asks N people the "how many" question. These N friends answer one by one. Some tell the truth, some lie. What hh knows is: 1.number of people, who have ipad IIs, and lie, is no more than A. 2.number of people, who don't have ipad IIs, and tell the truth, is no more than B. 3.At least one people have ipad II. How many ipad IIs do these N people have? Input The input begins with an integer T(1<=T<=100). The next T blocks each indicates a case. The first line of each case contain a number N(1<=N<=16) then N positive integers follow, integers won't be lager than N. Then following two numbers A , B(0 <= A,B <= N). Output Output the number of people have ipad II. There may be many answers, output them by increasing order. (separated by space) Output "impossible" if that's impossible. Sample Input
Sample Output
Author NotOnlySuccess Source | ||||||||||
|