QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 256 MB Total points: 100 Difficulty: [show] Hackable ✓

#14435. Lại Một Bài Toán Kiến Tạo Khác

Statistics

Bạn được cho một hoán vị $a$ có độ dài $n$. Bạn cũng được cho các số nguyên dương $k$ và $m$ ($1 \le k \le m \le n$).

Bạn được yêu cầu cho biết liệu có tồn tại một dãy con $b$ của $a$ có độ dài $m$ sao cho độ dài của dãy con tăng dài nhất của $b$ bằng $k$ hay không. Trong trường hợp tồn tại dãy con như vậy, bạn hãy in ra một dãy con bất kỳ thỏa mãn.

Dữ liệu vào

Dòng đầu tiên chứa ba số nguyên $n, m, k$ ($1 \le k \le m \le n \le 5\,000$) — độ dài của hoán vị, độ dài của dãy con $b$, và độ dài của dãy con tăng dài nhất của $b$.

Dữ liệu ra

Ở dòng đầu tiên, in ra “Yes” hoặc “No”. Trình chấm không phân biệt chữ hoa chữ thường.

Ở dòng thứ hai, in ra một trong các dãy con thỏa mãn nếu tồn tại.

Ví dụ

Dữ liệu vào 1

5 2 2
4 5 3 2 1

Dữ liệu ra 1

Yes
4 5

Dữ liệu vào 2

5 2 2
5 4 3 2 1

Dữ liệu ra 2

No

Dữ liệu vào 3

6 4 2
1 3 4 2 6 5

Dữ liệu ra 3

Yes
4 2 6 5

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#373EditorialOpen题解jianglyView

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.