## VM7WC '15 #3 Gold - Pollos

View as PDF

Points: 12
Time limit: 1.4s
Memory limit: 64M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Gustavo Fring is a kingpin for the sale and production of math. His restaurant chain, Los Pollos Hermathos is secretly a series of locations in his distribution network. He has restaurants in his distribution chain, which are arranged along a highway at distinct positions.

Each restaurant has a position on the highway, , which represents its distance from position and a value . If , the restaurant is said to be fringy. Otherwise it is regular. In addition to the restaurants, Gus has a math lab at position on the highway.

Gus wants to send a truck from his math lab at position to the last restaurant in his distribution chain. The truck has a fuel capacity and can only travel a distance of before it must stop at a restaurant and refuel (assume the truck starts with a full tank of fuel at the beginning). The driver also has the choice to simply drive by a restaurant. However, the truck must stop at all fringy restaurants so the driver can do math. Fring also wants the truck to stop at most restaurants (including the last restaurant, but not including the math lab) in order to increase the efficiency of his distribution network.

Help Fring calculate the minimum fuel capacity the truck needs so that it will be able to reach the last restaurant while stopping at most times.

#### Input Specification

The first line of input will contain two space-separated integers and . The next lines will contain two space-separated integers, and , describing each restaurant in the chain. The restaurants will be given in increasing order of position. The math lab is at position and will not appear in the input.

#### Output Specification

Print a single integer, the minimum value of , the fuel capacity of the truck, so that the truck needs to stop at most times. If the trip is not possible, print DEA Bust!.

#### Sample Input 1

5 3
10 0
15 1
19 0
22 0
25 0

#### Sample Output 1

10

#### Explanation for Sample Input 1

With a fuel capacity of 10, the truck can stop at locations 10, 15, and 25, stopping only 3 times, thus satisfying Fring's limit.

#### Sample Input 2

4 2
1 1
2 1
3 1
4 1

#### Sample Output 2

DEA Bust!

#### Explanation for Sample Input 2

The truck must visit all 4 restaurants since they are all fringy, but he is only allowed to stop twice. Therefore there is no solution to this test case.