QOJ.ac

QOJ

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

#14435. Un altro problema costruttivo

Statistics

Ti viene data una permutazione $a$ di lunghezza $n$. Ti vengono inoltre dati gli interi positivi $k$ e $m$ ($1 \le k \le m \le n$).

Ti viene chiesto di stabilire se esiste una sottosequenza $b$ di $a$ di lunghezza $m$ tale che la lunghezza della più lunga sottosequenza crescente di $b$ sia uguale a $k$. Nel caso in cui tale sottosequenza esista, ti viene chiesto di stamparne una qualsiasi corretta.

Input

La prima riga contiene tre interi $n, m, k$ ($1 \le k \le m \le n \le 5\,000$) — la lunghezza della permutazione, la lunghezza della sottosequenza $b$ e la lunghezza della più lunga sottosequenza crescente di $b$.

Output

Nella prima riga, stampa “Yes” oppure “No”. Il correttore non distingue tra maiuscole e minuscole.

Nella seconda riga, stampa una delle sottosequenze corrette se ne esiste una.

Esempi

Input 1

5 2 2
4 5 3 2 1

Output 1

Yes
4 5

Input 2

5 2 2
5 4 3 2 1

Output 2

No

Input 3

6 4 2
1 3 4 2 6 5

Output 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.