| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 512 MB | 46 | 19 | 12 | 36.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.
5 3
0 1 0 1 0
5 5
-1