포럼
문제 COCI00385

Poplava

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

Mirko dreamt of a histogram last night that consists of \(N\) columns. Each column is one meter wide
and the heights of the columns in meters are \(h_{1}\), \(h_{2}\), ..., \(h_{N}\).
The capacity of a histogram is the maximal
amount of water that a histogram can hold so
that the configuration of the water is "stable",
or, in other words, that it doesn’t move un-
der the influence of gravity. The image on the
right depicts an example of a stable configura-
tion.
Formally, let us denote the heights of water above
the columns with \(v_{1}\), \(v_{2}\), ..., \(v_{N}\).
The configuration of the water is stable if the fol-
lowing holds:
\(h_{i} + v_{i}\)\(h_{i - 1} + v_{i - 1}\), for each \(i\) ⩾2 such
that \(v_{i} > 0\)
\(h_{i} + v_{i}\)\(h_{i+1} + v_{i+1}\), for each \(i\)\(N - 1\)
such that \(v_{i} > 0\)
\(v_{1} = 0\) and \(v_{N} = 0\)
When Mirko woke up, he wanted to know whether he could somehow choose the heights of columns
that are a permutation of the set {1, 2, ..., N} such that the capacity of such histogram is equal to
its lucky number \(X\)? Help Mirko and find one histogram that meets his requirements.

제약
입력 형식

The first line of input contains integers \(N\) and \(X\) (1 ⩽\(N\) ⩽1 000 000, 1 ⩽\(X\)\(10^{15}\)).

출력 형식

If a histogram of capacity exactly \(X\) does not exist, output - 1. Otherwise, output numbers \(h_{1}\), \(h_{2}\), ..., \(h_{N}\)
that meet the given requirements in the first line separated by space. If there are multiple such solu-
tions, output any.

예제 1
입력
3 1
4 1
8 17
출력
output
output
3 1 2
4 3 1 2
6 2 3 1 8 4 5 7
설명

Clarification of the first example: In this configuration, it holds v1 = 0, v2 = 1, v3 = 0.
Clarification of the second example: In this configuration, it holds v1 = 0, v2 = 0, v3 = 1, v4 = 0.
Clarification of the third example: The sample corresponds to the image from the task.

문제 정보

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

출처 COCI 2015/2016 Contest 5

평가 및 의견

Poplava

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

Log in to rate problems.

개별 의견

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

풀이 제출

Poplava

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