P3154 [CQOI2009] Round-robin Tournament
Description
$n$ teams play a round-robin: every pair of teams plays exactly once, and a draw gives $1$, a win $3$, and a loss $0$ points.
Given the teams’ final scores, find how many possible scoreboards there are.
```平1胜3负0``` means:
- If two teams draw, each receives $1$ point.
- Otherwise, the winner receives $3$ points, and the defeated team receives $0$ points.
Input Format
The first line contains a positive integer $n$, the number of teams. The second line contains $n$ non-negative integers, the score of each team.
Output Format
Output a single line: the number of possible scoreboards. It is guaranteed that at least one possible scoreboard exists.
Explanation/Hint
All testdata satisfy $n \le 8$.
Translated by ChatGPT 5