QOJ.ac

QOJ

実行時間制限: 2 s メモリ制限: 1024 MB 満点: 100 ハック可能 ✓

#18584. MEXMEX

統計

$\textrm{MEX}$ là hàm tìm số nguyên không âm nhỏ nhất không có trong một tập hợp. Ví dụ: $\textrm{MEX}(\{0,1,3,4\})=2$ và $\textrm{MEX}(\{1,2,4\})=0$.

ibasic định nghĩa hàm $\textrm{MEXMEX}$ cho một dãy số $A$ có độ dài $N$ gồm các số nguyên không âm như sau: $$\textrm{MEXMEX}(A)=\textrm{MEX}(\{\textrm{MEX}(\{A_l,A_{l+1},\dots,A_r\})\mid 1\le l\le r\le N\})$$

Nói cách khác, $\textrm{MEXMEX}(A)$ là giá trị $\textrm{MEX}$ của tập hợp các giá trị $\textrm{MEX}$ của tất cả các dãy con liên tiếp của dãy $A$.

Hãy giúp ibasic tìm một dãy $A$ có độ dài $N$ sao cho $\textrm{MEXMEX}(A)=K$.

Dữ liệu vào

Dòng đầu tiên chứa hai số nguyên $N$ và $K$ cách nhau bởi dấu cách. $(1\le N\le 2\times 10^5;$ $0\le K\le N+1)$

Dữ liệu ra

Dòng đầu tiên in ra các phần tử của dãy $A_1, A_2, \dots, A_N$ thỏa mãn điều kiện, cách nhau bởi dấu cách. $(0\le A_i\le 2^{31}-1)$

Nếu không tồn tại dãy số thỏa mãn điều kiện, hãy in ra -1. Nếu có nhiều dãy số thỏa mãn, bạn có thể in ra bất kỳ dãy nào trong số đó.

Ví dụ

Dữ liệu vào 1

6 7

Dữ liệu ra 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.