A11248 | Set Theory
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Masha and Grisha like studying sets of positive integers.
One day Grisha has written a set $A$ containing $n$ different integers $a_{i}$ on a blackboard. Now he asks Masha to create a set $B$ containing $n$ different integers $b_{j}$ such that all $n^{2}$ integers that can be obtained by summing up $a_{i}$ and $b_{j}$ for all possible pairs of $i$ and $j$ are different.
Both Masha and Grisha don't like big numbers, so all numbers in $A$ are from $1$ to $10^{6}$ , and all numbers in $B$ must also be in the same range.
Help Masha to create the set $B$ that satisfies Grisha's requirement.
One day Grisha has written a set $A$ containing $n$ different integers $a_{i}$ on a blackboard. Now he asks Masha to create a set $B$ containing $n$ different integers $b_{j}$ such that all $n^{2}$ integers that can be obtained by summing up $a_{i}$ and $b_{j}$ for all possible pairs of $i$ and $j$ are different.
Both Masha and Grisha don't like big numbers, so all numbers in $A$ are from $1$ to $10^{6}$ , and all numbers in $B$ must also be in the same range.
Help Masha to create the set $B$ that satisfies Grisha's requirement.
输入格式
Input data contains multiple test cases. The first line contains an integer $t$ — the number of test cases ( $1<=t<=100$ ).
Each test case is described in the following way: the first line of the description contains one integer $n$ — the number of elements in $A$ ( $1<=n<=100$ ).
The second line contains $n$ integers $a_{i}$ — the elements of $A$ ( $1<=a_{i}<=10^{6}$ ).
Each test case is described in the following way: the first line of the description contains one integer $n$ — the number of elements in $A$ ( $1<=n<=100$ ).
The second line contains $n$ integers $a_{i}$ — the elements of $A$ ( $1<=a_{i}<=10^{6}$ ).
输出格式
For each test first print the answer:
- NO, if Masha's task is impossible to solve, there is no way to create the required set $B$ .
- YES, if there is the way to create the required set. In this case the second line must contain $n$ different positive integers $b_{j}$ — elements of $B$ ( $1<=b_{j}<=10^{6}$ ). If there are several possible sets, output any of them.
- NO, if Masha's task is impossible to solve, there is no way to create the required set $B$ .
- YES, if there is the way to create the required set. In this case the second line must contain $n$ different positive integers $b_{j}$ — elements of $B$ ( $1<=b_{j}<=10^{6}$ ). If there are several possible sets, output any of them.
输入输出样例
输入 #1
3 3 1 10 100 1 1 2 2 4
输出 #1
YES 1 2 3 YES 1 YES 1 2
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted