#P1020. [NOIP 1999 提高组] 导弹拦截

    ID: 20 远端评测题 1000ms 128MiB 尝试: 2 已通过: 2 难度: 6 上传者: 标签>动态规划,dp贪心1999二分NOIp 普及组Special Judge

[NOIP 1999 提高组] 导弹拦截

Description

To defend against enemy missile attacks, a country developed a missile interception system. However, this system has a flaw: although the first shell can reach any height, each subsequent shell cannot be higher than the previous one. One day, the radar detected incoming enemy missiles. Since the system is still in the trial phase, there is only one set available, so it might not be able to intercept all missiles.

Given the heights of the incoming missiles in order, compute the maximum number of missiles this system can intercept, and the minimum number of such missile interception systems needed to intercept all missiles.

Input Format

One line containing several integers separated by spaces.

Output Format

Two lines, one integer per line. The first number is the maximum number of missiles this single system can intercept. The second number is the minimum number of such systems required to intercept all missiles.

389 207 155 300 299 170 158 65
6
2

Hint

For the first 50%50\% of the testdata (NOIP original testdata), the number of missiles does not exceed 10410^4. This part contributes 100100 points in total. An O(n2)\mathcal O(n^2) algorithm can pass.
For the remaining 50%50\% of the testdata, the number of missiles does not exceed 10510^5. This part also contributes 100100 points in total. Please use an O(nlogn)\mathcal O(n \log n) algorithm to pass.

For all testdata, missile heights are positive integers not exceeding 5×1045 \times 10^4.

In addition, this problem enables SPJ; there are two sub-questions per test point, and scoring is per sub-question.

NOIP 1999 Senior Problem 1.


upd 2022.8.24\text{upd 2022.8.24}:A new hack testdata has been added.

Translated by ChatGPT 5