#P4445. [AHOI2018初中组] 报名签到
[AHOI2018初中组] 报名签到
Description
students (numbered from to ) arrive at the gym at the same time to register and check in, and to receive their admission tickets and contest materials. To keep the registration orderly, these students must line up in a straight line from front to back in increasing order of their numbers (the student with number stands at the very front). However, each student dislikes crowding: for the -th student, if there is another student whose distance to him/her is less than , a conflict occurs. Xiao Keke wants to know, under the condition that no conflicts occur, what is the minimum possible length of the queue formed by these students.
Input Format
The first line contains an integer , the number of students.
The second line contains integers. The -th integer denotes the distance that the -th student must keep from other students.
Output Format
Output one line with a single integer, the minimum possible length of the queue formed by these students.
Note: The students must line up from front to back in the order to .
3
3 1 2
5
Hint
For of the testdata: .
For of the testdata: .
For of the testdata: ,.
Translated by ChatGPT 5
京公网安备 11011102002149号