#P12566. [UOI 2023] An Array and Several More Arrays
[UOI 2023] An Array and Several More Arrays
题目描述
There are arrays of integers , where the array with index contains elements. Let .
You need to find integers such that the numbers are pairwise distinct and satisfy .
输入格式
The first line contains two integers and (, ) -- the total number of elements in the arrays and the number of arrays, respectively.
The next lines contain the arrays. The -th line contains an integer () and integers () -- the length and elements of the -th array, respectively.
It is guaranteed that .
输出格式
If the required values of do not exist, output a single line No
.
Otherwise, output Yes
on the first line.
On the second line, output integers -- the values that need to be added to the elements of the arrays to form a total of distinct integers from to .
If there are multiple correct answers, any one of them may be output.
5 5
1 1
1 2
1 3
1 4
1 5
Yes
0 0 0 0 0
6 4
2 2 3
1 6
1 4
2 1 5
Yes
1 -5 1 1
7 2
4 1 4 5 6
3 1 2 6
Yes
0 1
4 2
2 2 3
2 2 4
No
提示
In the first example, satisfies the condition, since after adding the corresponding values, the arrays , , , , are formed.
In the second example, satisfies the condition, since after adding the corresponding values, the arrays , , , are formed.
In the third example, satisfies the condition, since after adding the corresponding values, the arrays and are formed.
Scoring
- ( points): ;
- ( points): for , ;
- ( points): ;
- ( points): ;
- ( points): for , ;
- ( points): $(\max_{j \in [1;l_i]} a_{i,j}) - (\min_{j \in [1;l_i]} a_{i,j})=(n-k)$ for ;
- ( points): ;
- ( points): without additional constraints.