P7887 "MCOI-06" Existence of Truth
Description
There may exist a sequence of non-negative integers $a_1,a_2,\dots,a_n$ such that $0\le a_i
Input Format
**This problem contains multiple test cases.**
The first line contains a positive integer $T$, representing the number of test cases. For each test case:
The first line contains a positive integer $n$.
The next $n$ lines each contain three positive integers $x_i,y_i,z_i$.
Output Format
For each test case, output in order:
The first line contains a non-negative integer $k$, the number of valid solutions.
If $k=1$, output $n$ non-negative integers on the second line, in order: $a_1,a_2,\dots,a_n$.
Explanation/Hint
#### Constraints and Notes
**This problem uses bundled testdata.**
- Subtask 1 (10 pts): $n=1$.
- Subtask 2 (19 pts): $\sum n\le100$.
- Subtask 3 (19 pts): $x_i=y_i=1$.
- Subtask 4 (22 pts): It is guaranteed that there is a **unique solution.**
- Subtask 5 (30 pts): No special restrictions.
For all testdata:
- $1\le n,\sum n\le 2\times10^5$;
- $1\le x_i,y_i