#CODEFORCESP7348. Company Income Growth

Company Income Growth

Company Income Growth

题面翻译

题目描述

给出一个长度为nn的序列ai(i[1,N])a_i(i \in [1,N]),求一个最长的递增序列bib_i,设其长度为KK,则有i[1,K],abi2000=i\forall i \in [1,K] , a_{b_i-2000}=i

输入格式

第一行一个正整数n(1n100)n(1 \leq n \leq 100)表示序列长度

第二行nn个整数ai(100ai100)a_i(-100 \leq a_i \leq 100)

输出格式

第一行一个非负整数KK表示bib_i的长度

接下来KK个正整数描述序列bib_i

题目描述

Petya works as a PR manager for a successful Berland company BerSoft. He needs to prepare a presentation on the company income growth since 2001 2001 (the year of its founding) till now. Petya knows that in 2001 2001 the company income amounted to a1 a_{1} billion bourles, in 2002 2002 — to a2 a_{2} billion, ..., and in the current (2000+n) (2000+n) -th year — an a_{n} billion bourles. On the base of the information Petya decided to show in his presentation the linear progress history which is in his opinion perfect. According to a graph Petya has already made, in the first year BerSoft company income must amount to 1 1 billion bourles, in the second year — 2 2 billion bourles etc., each following year the income increases by 1 1 billion bourles. Unfortunately, the real numbers are different from the perfect ones. Among the numbers ai a_{i} can even occur negative ones that are a sign of the company’s losses in some years. That is why Petya wants to ignore some data, in other words, cross some numbers ai a_{i} from the sequence and leave only some subsequence that has perfect growth.

Thus Petya has to choose a sequence of years y1 y_{1} , y2 y_{2} , ..., yk y_{k} ,so that in the year y1 y_{1} the company income amounted to 1 1 billion bourles, in the year y2 y_{2} 2 2 billion bourles etc., in accordance with the perfect growth dynamics. Help him to choose the longest such sequence.

输入格式

The first line contains an integer n n ( 1<=n<=100 1<=n<=100 ). The next line contains n n integers ai a_{i} ( 100<=ai<=100 -100<=a_{i}<=100 ). The number ai a_{i} determines the income of BerSoft company in the (2000+i) (2000+i) -th year. The numbers in the line are separated by spaces.

输出格式

Output k k — the maximum possible length of a perfect sequence. In the next line output the sequence of years y1 y_{1} , y2 y_{2} , ..., yk y_{k} . Separate the numbers by spaces. If the answer is not unique, output any. If no solution exist, output one number 0 0 .

样例 #1

样例输入 #1

10
-2 1 1 3 2 3 4 -10 -2 5

样例输出 #1

5
2002 2005 2006 2007 2010

样例 #2

样例输入 #2

3
-1 -2 -3

样例输出 #2

0