F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Increasing and Decreasing

Time Limit: 3000/3000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 1221    Accepted Submission(s): 451


Problem Description
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.
 

Input
The first line contains an integer $T(1 \leq T \leq 100)$, indicating the number of test cases.

Each test case contains one line, which contains three integers $n, x, y(1 \leq n \leq 10^5, 1 \leq x, y \leq n)$.
 

Output
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.
 

Sample Input
4 10 1 10 10 10 1 10 5 5 10 8 8
 

Sample Output
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
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 02:45:43, Gzip enabled