-->
当前位置:首页 > 题库

PROGRAMMING:The end of happiness

Luz5年前 (2021-05-10)题库459
Happy Fengnan has n soldiers in front of him, which are arranged in a linear order and numbered as 1 ~ n. each soldier carries a [i] gold coin 1 < = I < = 1E5. In order to reflect the extreme happiness, happy Fengnan knows the gold coin that each soldier carries. Happy Fengnan E has no forward (that is, he will not turn back), but happy Fengnan's gold coin increases strictly every time he carries e, so that he can be a little happier, Please give his e-soldier's scheme (ascending subsequence subscript, for example, the longest ascending subsequence of the sample is 1234, you need to output its corresponding subscript 1235), so that the more soldiers he e has, the better. If there are multiple happy schemes, the minimum dictionary order is 1 < = n < = 100000
(since the original data is not grouped, there is no need to read in T, that is, one case for each data.)
###Input format:
In the first line, enter n to indicate that there are n soldiers. In the second line, each soldier carries gold coins
###Output format:
The first line gives the maximum number of soldiers that happy Fengnan can use, and the second line gives the best plan
###Input example:
```in
five
1 2 3 3 4
```
###Output example:
```out
four
1 2 3 5
```







answer:If there is no answer, please comment