7574: Increasing and Decreasing

内存限制:512 MB 时间限制:3 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:12 通过:11

题目描述

Notice:Don't output extra spaces at the end of one line.

Given n,x,y, please construct a permutation of length n, satisfying that:

- The length of LIS(Longest Increasing Subsequence) is equal to x.
- The length of LDS(Longest Decreasing Subsequence) is equal to y.

If there are multiple possible permutations satisfying all the conditions, print the lexicographically minimum one.

输入格式

The first line contains an integer T(1≤T≤100), indicating the number of test cases.

Each test case contains one line, which contains three integers n,x,y(1≤n≤105,1≤x,y≤n).

输出格式

For each test case, the first line contains ``YES'' or ``NO'', indicating if the answer exists. If the answer exists, output another line which contains n integers, indicating the permutation.

输入样例 复制

4
10 1 10
10 10 1
10 5 5
10 8 8

输出样例 复制

YES
10 9 8 7 6 5 4 3 2 1
YES
1 2 3 4 5 6 7 8 9 10
YES
1 2 3 5 4 10 9 8 7 6
NO