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

5521번 - The Circle 다국어

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

문제

You have a circle, divided into sectors. You are given three positive numbers: n (n<=6), m (m<=20) and k (k<=20). n is the number of sectors. Choose integers to place in each sector. All integers have to be greater or equal to k. When the circle is filled you can use the integer in a single sector or add the integers in two or more adjacent sectors to make a new number. Using these new numbers you can create an unbroken sequence of all integers between m and i (m,m+1,m+2 ... i).

Your task is to choose integers for the sectors such that the largest number (i) in the sequence is as high as possible. Figure 1 below shows how to generate all numbers from 2 to 21 (for n=5, m=2, k=1). The ^-sign below the sectors shows which sectors to add together to make numbers in the sequence.

입력

The standard input contains three integers (n, m and k).

출력

The standard output must contain:

  • The highest number (i) that can be generated with the list of numbers.
  • All arrangements of numbers in a circle that produce a sequence from m to i. (One per line.) Each arrangement is a list of numbers starting with the smallest number (which is not necessarily unique).

(2 10 3 1 5) is NOT a valid solution, since it does not start with the smallest number. (1 3 10 2 5) and (1 5 2 10 3) must both be included in the output. Note that (1 1 2 3), (1 3 2 1), (1 2 3 1) and (1 1 3 2) should all be output.

제한

예제 입력 1

5
2
1

예제 출력 1

21
1 3 10 2 5
1 5 2 10 3
2 4 9 3 5
2 5 3 9 4

힌트

FIGURE 1 (all circles have been cut open as indicated by arrow):
 |----------| |----------| |----------| |----------| 
.->|1|3|10|2|5|-. |1|3|10|2|5| |1|3|10|2|5| |1|3|10|2|5| 
| |----------| | |----------| |----------| |----------| 
| ^ | ^ ^ ^ ^
"---------------" 
 
 |----------| |----------| |----------| |----------| 
.->|1|3|10|2|5|-. |1|3|10|2|5| |1|3|10|2|5| |1|3|10|2|5| 
| |----------| | |----------| |----------| |----------| 
| ^ ^ | ^ ^ ^ ^ ^ ^ ^ ^ 
"---------------" 
 |----------| |----------| |----------| |----------| 
.->|1|3|10|2|5|-. |1|3|10|2|5| |1|3|10|2|5| |1|3|10|2|5| 
| |----------| | |----------| |----------| |----------| 
| ^ | ^ ^ ^ ^ ^ ^ ^ ^ ^
"---------------" 
 |----------| |----------| |----------| |----------| 
.->|1|3|10|2|5|-. |1|3|10|2|5| |1|3|10|2|5| |1|3|10|2|5| 
| |----------| | |----------| |----------| |----------| 
| ^ ^ | ^ ^ ^ ^ ^ ^ ^ ^
"---------------" 
 |----------| |----------| |----------| |----------| 
.->|1|3|10|2|5|-. |1|3|10|2|5| |1|3|10|2|5| |1|3|10|2|5| 
| |----------| | |----------| |----------| |----------| 
| ^ ^ ^ ^ | ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
"---------------" 
 |----------| |----------| 
.->|1|3|10|2|5|-. |1|3|10|2|5| 
| |----------| | |----------| 
| ^ ^ ^ ^ | ^ ^ ^ ^ ^ 
"---------------" 

출처

Olympiad > International Olympiad in Informatics > IOI 1994 > Day 2 6번

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

출처

대학교 대회

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

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