All submissions for this problem are available.
You joined a FOOLS - FOOTBALL CLUB as a coach. There are N players in the club, each one of the player either belongs to TEAM A or TEAM B. None of the players are equal in strength pairwise.
Since you are new to the club you dont know the players strengths.
So you start asking every player a question " HOW MANY PLAYERS IN YOUR TEAM(TEAM A or TEAM B) ARE BETTER THAN YOU?". Now each player either of TEAM A or B tells the number of players better than him in his TEAM respectively. Since the players know each of thier team-mates so they know how many are better than him.(Players can lie too)
Let the answer given by the k-th player be answer[k]. Given these numbers, print the number of configurations resulting in exactly those numbers, assuming everone tells the truth.
Two configurations are different if the k-th player is of TEAM A in one configuration and of TEAM B in other configuration.
First line of input contains number of test cases T.
Then each of the next T lines contains an integer N (total number of players in CLUB) and then N integers(ANSWER ARRAY) separated by space in the same line.
For each Test Case print the number of configurations in a new line.
- 1 ≤ T ≤ 10000
- 1 ≤ N ≤ 42
Input: 3 5 0 1 2 3 4 11 12 11 10 5 4 3 2 1 0 13 11 4 0 1 0 1 Output: 2 0 4
In first test case either all the players of team 1 or team 2.
In second test case there are only 11 players , So some players are lying.
In the third test case There are two Players of team A and two Players of team B.
|Time Limit:||5 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, JAVA, PYTH, PYTH 3.6, CAML|
Fetching successful submissions
If you are still having problems, see a sample solution here.