luogu#P7887. 「MCOI-06」Existence of Truth
「MCOI-06」Existence of Truth
Problem Description
There may exist a sequence of non-negative integers such that .
Given , , and , it is known that for :
$$x_i\left(\sum_{j=1}^ia_j\right)+y_i\left(\sum_{j=i}^na_j\right)\equiv z_i\pmod{10^9+7}$$Find .
Input Format
This problem contains multiple test cases.
The first line contains a positive integer , representing the number of test cases. For each test case:
The first line contains a positive integer .
The next lines each contain three positive integers .
Output Format
For each test case, output in order:
The first line contains a non-negative integer , the number of valid solutions.
If , output non-negative integers on the second line, in order: .
2
3
3 1 9
2 2 16
1 3 15
6
3 6 246
5 7 283
2 7 179
4 6 214
8 7 337
3 5 151
1
1 2 3
1
8 8 0 6 7 8
Hint
Constraints and Notes
This problem uses bundled testdata.
- Subtask 1 (10 pts): .
- Subtask 2 (19 pts): .
- Subtask 3 (19 pts): .
- Subtask 4 (22 pts): It is guaranteed that there is a unique solution.
- Subtask 5 (30 pts): No special restrictions.
For all testdata:
- ;
- ;
- .
Translated by ChatGPT 5