logo AlgoBeat OnlineJudge
登录 注册

#212627. [UOI 2023] An Array and Several More Arrays

内存限制:256 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

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.

样例

样例输入 1

5 5
1 1
1 2
1 3
1 4
1 5

样例输出 1

Yes
0 0 0 0 0

样例输入 2

6 4
2 2 3
1 6
1 4
2 1 5

样例输出 2

Yes
1 -5 1 1

样例输入 3

7 2
4 1 4 5 6
3 1 2 6

样例输出 3

Yes
0 1

样例输入 4

4 2
2 2 3
2 2 4

样例输出 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): for ;
  • ( points): ;
  • ( points): without additional constraints.