QOJ.ac

QOJ

Límite de tiempo: 2 s Límite de memoria: 1024 MB Puntuación total: 100 Hackeable ✓

#18584. MEXMEX

Estadísticas

$\textrm{MEX}$ は、集合に含まれない最小の非負整数を求める関数である。例えば、$\textrm{MEX}(\{0,1,3,4\})=2$ であり、$\textrm{MEX}(\{1,2,4\})=0$ である。

ibasic は、長さが $N$ で非負整数からなる数列 $A$ に対して、$\textrm{MEXMEX}$ 関数を次のように定義した。 $$\textrm{MEXMEX}(A)=\textrm{MEX}(\{\textrm{MEX}(\{A_l,A_{l+1},\dots,A_r\})\mid 1\le l\le r\le N\})$$

すなわち、$\textrm{MEXMEX}(A)$ は、数列 $A$ のすべての連続部分列について、各部分列のすべての要素からなる集合の $\textrm{MEX}$ を求めた値の集合に対し、さらに $\textrm{MEX}$ を適用した値である。

ibasic のために、$\textrm{MEXMEX}(A)=K$ となる長さ $N$ の数列 $A$ を求めよ。

入力

1行目に2つの整数 $N, K$ が空白区切りで与えられる。$(1\le N\le 2\times 10^5;$ $0\le K\le N+1)$

出力

1行目に条件を満たす数列 $A_1, A_2, \dots, A_N$ を空白区切りで出力する。$(0\le A_i\le 2^{31}-1)$

ただし、条件を満たす数列が存在しない場合は -1 を出力する。条件を満たす数列が複数存在する場合は、そのうちのどれか1つを出力すればよい。

入出力例

入力 1

6 7

出力 1

0 1 2 3 4 5

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.