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

24697번 - Interesting Subsegments 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB46191236.364%

문제

A subsegment (contiguous subarray) of an array is interesting if the sum of values on this subsegment is divisible by 3ドル$.

You are given two integers $n$ and $k$. Your goal is to construct the lexicographically minimal array of length $n$ such that it consists only of integers 0ドル,ドル 1ドル,ドル and 2ドル,ドル and has exactly $k$ distinct interesting subsegments.

Array $a$ of length $n$ is lexicographically smaller than array $b$ of the same length if there is 1ドル \le i \le n$ such that $a_j = b_j$ for $j < i$ and $a_i < b_i$. Two subsegments are distinct if some element of the array belongs to one subsegment but not to the other.

입력

The only line of input contains two integers $n$ and $k$ (1ドル \le n \le 10^6,ドル 0ドル \le k \le 10^{18}$).

출력

Output -1 if there is no such array. Otherwise, output the lexicographically smallest array of size $n$ which satisfies the constraints.

제한

예제 입력 1

5 3

예제 출력 1

0 1 0 1 0

예제 입력 2

5 5

예제 출력 2

-1

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2022 > Day 5: Yandex Cup B번

Contest > Open Cup > 2021/2022 Season > Stage 12: Grand Prix of Grushevka B번

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

출처

대학교 대회

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

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