Alice and Bob are hanging out in a park near the university!
Unfortunately, since classes are happening, people keep walking through the park, disturbing the pair! There are
Alice and Bob will stay in the park for
If he changes the time of at most one class optimally, what is the maximum contiguous section of time he and Alice can spend undisturbed?
Constraints
Subtask 1 [10%]
Subtask 2 [20%]
Subtask 3 [70%]
No additional constraints.
Input Specfication
The first line will contain three integers,
The next line will contain
Output Specification
Output the maximum time Bob and Alice can spend undisturbed if Bob moves the class optimally.
Sample Input 1
2 10 2
1 7
Sample Output 1
7
Explanation for Sample 1
By moving the second class back by two minutes, Alice and Bob can spend the time from minute
Sample Input 2
3 8 5
1 7 8
Sample Output 2
6
Explanation for Sample 2
One possible solution is for Bob to make the first class end at time
Comments