Note that there are some explanatory texts on larger screens.

plurals
  1. POHow many possible scorecards are consistent with the input scorecard?
    primarykey
    data
    text
    <p>I have been trying to solve the following problem in interview street. Count Scorecards(30 points)</p> <p>In a tournament, N players play against each other exactly once. Each game results in either of the player winning. There are no ties. You have given a scorecard containing the scores of each player at the end of the tournament. The score of a player is the total number of games the player won in the tournament. However, the scores of some players might have been erased from the scorecard. How many possible scorecards are consistent with the input scorecard?</p> <p>Input: The first line contains the number of cases T. T cases follow. Each case contains the number N on the first line followed by N numbers on the second line. The ith number denotes s_i, the score of the ith player. If the score of the ith player has been erased, it is represented by -1.</p> <p>Output: Output T lines, containing the answer for each case. Output each result modulo 1000000007.</p> <pre><code>Constraints: 1 &lt;= T &lt;= 20 1 &lt;= N &lt;= 40 -1 &lt;= s_i &lt; N Sample Input: 5 3 -1 -1 2 3 -1 -1 -1 4 0 1 2 3 2 1 1 4 -1 -1 -1 2 Sample Output: 2 7 1 0 12 </code></pre> <p>Explanation: For the first case, there are 2 scorecards possible: 0,1,2 or 1,0,2. For the second case, the valid scorecards are 1,1,1, 0,1,2, 0,2,1, 1,0,2, 1,2,0, 2,0,1, 2,1,0. For the third case, the only valid scorecard is {0,1,2,3}. For the fourth case, there is no valid scorecard. It is not possible for both players to have score 1.</p> <p>I have tried to come up with generic functions approach, but i am really trying to nail down this problem using Dynamic programming. How can you think of recurrence relations for this problem?.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload