Problem I
Karlsruhe Skyline
Skyscrapers is a grid logic puzzle in which numbers from $1$ to $n$ have to be placed into an $n\times n$ grid. Each number needs to appear exactly once in each row and column. These numbers are to be thought of as skyscrapers which are the respective number of units tall. The rows and columns may have clue numbers on either end which describe the number of visible skyscrapers when looking down that row or column from that position, where taller buildings block the view of any shorter buildings behind them.
![\includegraphics[width=0.5\textwidth ]{sample1.png}](/problems/karlsruheskyline/file/statement/en/img-0001.png)
In this problem we consider only a single row of a Skyscrapers grid which has clue numbers on both ends. Find out whether it is possible to place the skyscrapers from $1$ to $n$ in this row to satisfy both clues, and if so, find a valid placement.
Input
The input consists of:
-
One line with three integers $n$, $a$ and $b$ ($2 \le n \le 1000$, $1 \le a,b \le n$), the length of the row and the clues on the left and right.
Output
If a valid placement exists, output “yes”, followed by $n$ distinct integers $h_1,\dots ,h_n$ ($1 \le h_i \le n$ for each $i$), the building heights from left to right.
If there are multiple valid solutions, you may output any one of them.
If no valid placement exists, output “no”.
Sample Input 1 | Sample Output 1 |
---|---|
5 2 2 |
yes 1 5 2 3 4 |
Sample Input 2 | Sample Output 2 |
---|---|
5 3 4 |
no |
Sample Input 3 | Sample Output 3 |
---|---|
10 3 4 |
yes 4 1 8 5 3 10 6 9 7 2 |
Sample Input 4 | Sample Output 4 |
---|---|
4 1 4 |
yes 4 3 2 1 |
Sample Input 5 | Sample Output 5 |
---|---|
9 1 1 |
no |
Sample Input 6 | Sample Output 6 |
---|---|
6 2 1 |
yes 5 3 1 2 4 6 |