RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
문제 ICPC00149

G. Decoration

스페셜 저지 — 출력을 사용자 정의 프로그램으로 검사하므로 여러 정답이 인정될 수 있습니다.
설명

1.5

After all these months of lockdown, you are tired of the interior decoration of your home and decide to redesign it. Hence, you read many blog posts and magazines about Feng Shui decorating and other recent trends on home design. After some time of thinking, you decide to reproduce the idea of the famous designer Sweta Marc for replacing your bookcase with a new one you will build.

According to S. Marc, a harmonious bookcase always has several shelves spaced in an heterogeneous manner, and always following some very precise rules. More precisely, such a bookcase has a serenity value \(N\) and is composed of \(K+1\) shelves spaced by \(s_1, \ldots, s_K\) millimeters between each other, from the bottom to the top. According to S. Marc ideals, these spaces should verify the following properties:
- They should be heterogeneous, i.e., no two spaces have the same height.
- They should be not too high, i.e., for all \(i \in [1, K]\), we should have \(0 \leq s_i < N\). Note that one of these spaces might actually have size \(0\): this is one of the oddities which make Sweta's tastes so visually attractive (arguably, this is a loss of space, but you are ready for that in the name of elegance, well-being... and trendiness).
- They should be serene, i.e., for all \(i \in [1, K-1]\), Sweta prefers if \(s_{i+1}\) is congruent modulo \(N\) to \(s_i\) plus the number of divisors of \(s_i\). (Yes, Ms. Marc is sophisticated and loves arithmetic.)

You tried to design a bookcase according to the advice of Sweta Marc, but you find it hard to satisfy all the requirements. The only few solutions you found result in a bookcase which is too tall for your place.

Therefore, you decide to write a program which, given the number of shelves \(K\) and the serenity value \(N\), computes the values of the spaces \(s_1, \ldots, s_K\) of one of the minimum height bookcases, i.e. a bookcase where the sum of spaces \(s_1 + \cdots + s_K\) is the smallest.

제약
입력 형식

The only line of input contains two integers \(N\) and \(K\) separated by a space.

출력 형식

The output should contain a single line containing either:
- \(-1\) if it is not possible to satisfy Sweta Marc's prescriptions for the given values of \(K\) and \(N\),
- otherwise, \(K\) integers \(s_1, \ldots, s_K\), corresponding to the spaces between the shelves of one of the minimum height bookcases satisfying the constraints. If several solutions are possible, the output should contain any of them.

예제 1
입력
18 10
출력
11 13 15 1 2 4 7 9 12 0
예제 2
입력
168 9
출력
1 2 4 7 9 12 18 24 32
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC SWERC 2020

평가 및 의견

G. Decoration

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

G. Decoration

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8