cf/mirror

Longest Max Min Subsequence

CF
2001D1900· candidate master2s256 MB⌨ stdin/stdout

Examples

Sample 1of 2
Input
4
4
3 2 1 3
4
1 1 1 1
9
3 2 1 3 2 1 3 2 1
1
1
Output
3
3 2 1
1
1
3
3 1 2
1
1
Sample 2of 2
Input
10
2
1 2
10
5 2 1 7 9 7 2 5 5 2
2
1 2
10
2 2 8 7 7 9 8 1 9 6
9
9 1 7 5 8 5 6 4 1
3
3 3 3
6
1 6 4 4 6 5
6
3 4 4 5 3 3
10
4 1 4 5 4 5 10 1 5 1
7
1 2 1 3 2 4 6
Output
2
1 2
5
5 1 9 7 2
2
1 2
6
2 7 9 8 1 6
7
9 1 7 5 8 6 4
1
3
4
1 4 6 5
3
4 5 3
4
5 4 10 1
5
2 1 3 4 6
2001D.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)