CF39B.Company Income Growth

普及-

通过率:0%

时间限制:2.00s

内存限制:64MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 (the year of its founding) till now. Petya knows that in 2001 the company income amounted to _a_1 billion bourles, in 2002 — to _a_2 billion, ..., and in the current (2000 + n)-th year — 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 billion bourles, in the second year — 2 billion bourles etc., each following year the income increases by 1 billion bourles. Unfortunately, the real numbers are different from the perfect ones. Among the numbers 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 a__i from the sequence and leave only some subsequence that has perfect growth.

Thus Petya has to choose a sequence of years _y_1, _y_2, ..., y__k,so that in the year _y_1 the company income amounted to 1 billion bourles, in the year _y_2 — 2 billion bourles etc., in accordance with the perfect growth dynamics. Help him to choose the longest such sequence.

佩佳在一家成功的贝尔兰公司“贝尔软件”(BerSoft)担任公关经理。他需要准备一份关于该公司自2001年(公司成立之年)至今收入增长情况的演示文稿。佩佳知道:2001年的公司收入为 a1a_1 十亿布尔币,2002年为 a2a_2 十亿布尔币,……,而当前(即 2000+n2000 + n)年第 nn 年的收入为 ana_n 十亿布尔币。基于这些信息,佩佳决定在演示文稿中展示一条他自认为“完美”的线性增长趋势图。根据佩佳已绘制好的图表,公司在第一年(即2001年)的收入应为 1 十亿布尔币,第二年(即2002年)为 2 十亿布尔币,依此类推——此后每一年收入均比前一年多 1 十亿布尔币。

不幸的是,实际数据与“完美”数值并不一致。在序列 aia_i 中甚至可能出现负数,这表示公司在某些年份出现了亏损。因此,佩佳希望忽略部分数据,即从原序列中删去若干项 aia_i,仅保留一个子序列,使其符合“完美”增长规律。

于是,佩佳需要选出一个年份序列 y1,y2,…,yky_1, y_2, \dots, y_k,使得公司在第 y1y_1 年的收入恰好为 1 十亿布尔币,第 y2y_2 年为 2 十亿布尔币,……,以此类推,完全符合上述“完美”增长规律。请帮助他选出满足条件的最长序列。

输入格式

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

第一行包含一个整数 nn(1≤n≤1001 \leq n \leq 100)。第二行包含 nn 个整数 aia_i(−100≤ai≤100-100 \leq a_i \leq 100)。数字 aia_i 表示 BerSoft 公司在 (2000+i)(2000 + i) 年的收入。该行中的数字以空格分隔。

输出格式

Output k — the maximum possible length of a perfect sequence. In the next line output the sequence of years _y_1, _y_2, ..., y__k. Separate the numbers by spaces. If the answer is not unique, output any. If no solution exist, output one number 0.

输出 k —— 完美序列的最大可能长度。
下一行输出年份序列 _y_₁, _y_₂, ..., y__k。数字之间用空格分隔。
若答案不唯一,输出任意一个即可。
若无解,仅输出一个数字 0。

输入输出样例

  • 输入#1

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

    输出#1

    5
    2002 2005 2006 2007 2010
  • 输入#2

    3
    -1 -2 -3

    输出#2

    0

输入解题思路,AI测评打分。不知道怎么写?

首页