Peanut is organising a talk today with a group of N people. The stage is M meters wide and the N people are seated in a line, each of them Di meters from the leftmost edge of the stage. Peanut wants to place some speakers along the line so that everyone can hear his speech. However, some people have hearing loss. Thus, each person i requires them to be at most Ri away from a speaker. Help Peanut determine what is the minimum number of speakers he needs to place such that everyone can hear his speech.
3 3 0 1 1 1 2 1
1
4 6 0 2 3 1 4 1 5 2
2
Subtask | Score |
---|---|
1 | 14 |
2 | 16 |
3 | 21 |
4 | 49 |
5 | 0 |