Logo
(追記) (追記ここまで)

35094번 - Karlsruhe Skyline 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB444100.000%

문제

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.

Figure K.1: Illustration of Sample Output 1. Two buildings (1 and 5) are visible from the left and two buildings (4 and 5) are visible from the right.

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.

입력

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.

출력

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

제한

예제 입력 1

5 2 2

예제 출력 1

yes
1 5 2 3 4

예제 입력 2

5 3 4

예제 출력 2

no

예제 입력 3

10 3 4

예제 출력 3

yes
4 1 8 5 3 10 6 9 7 2

예제 입력 4

4 1 4

예제 출력 4

yes
4 3 2 1

예제 입력 5

9 1 1

예제 출력 5

no

예제 입력 6

6 2 1

예제 출력 6

yes
5 3 1 2 4 6

노트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > German Collegiate Programming Contest > GCPC 2025 K번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /