#P1410. 子序列

    ID: 403 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>动态规划,dp福建省历届夏令营

子序列

Description

Given a sequence of length NN (where NN is even), determine whether it can be partitioned into two strictly increasing subsequences, each of length N/2N / 2.

Input Format

Multiple lines, each line represents one set of testdata.

For each set of testdata, first input an integer NN, the length of the sequence. Then NN integers follow, representing the sequence.

Output Format

The number of output lines is the same as the number of input lines.

For each set of testdata, if such a partition exists, output Yes!, otherwise output No!.

6 3 1 4 5 8 7
6 3 2 1 6 5 4

Yes!
No!

Hint

Constraints

There are three sets of testdata, each set contains at most 5050 lines, 00 \le all input numbers 109\le 10^9.

Set 1 (30%30\%): N20N \le 20;

Set 2 (30%30\%): N100N \le 100;

Set 3 (40%40\%): N2000N \le 2000.

Translated by ChatGPT 5