Adventures in Moving - Part V

Time limit1sMemory limit128 MB

Summary
Decide whether a rectangular box can pass through a height-limited doorway and rest flat on the floor against the front wall of a van.
Level

Medium7 of 10

Topics
Geometry, Math, Implementation, Brute force
Solved
No attempts yet

Problem

To save money, you are thinking about renting a small cube van to move your belongings to the Big City. The inside of the van is a rectangular box with width ww, height hh, and length ll. The van has a sliding door at the back that only lifts to height HH (with H≤hH \le h), so there is a fixed overhang of height h−Hh - H at the top of the doorway.

You have one large rectangular box that you want to load onto the van. You can load it only if all of the following are satisfied:

  • The box fits through the doorway, tilting it forward or sideways (but not both) if necessary.
  • The box is placed with one face flat on the floor.
  • The box is placed with one face flat against the front wall.
  • The door can be closed once the box is in place.

You may assume there are no obstructions outside the van (such as a ceiling or the ground) that would interfere with loading.

Input

The input contains several test cases. Each test case is given on two lines. The first line contains four integers ww, hh, ll, and HH. The second line contains three integers: the three side lengths of the box. The input continues until end of file.

Output

For each test case, print The box goes on the truck. if the box can be loaded onto the van; otherwise print The box will not go on the truck. Each test case starts with an empty van.

Examples3

  1. Example 1

    Input
    8 8 12 7
    8 12 8
    8 8 12 7
    7 12 8
    8 8 12 7
    1 7 13
    100 200 99 190
    100 195 30
    
    Expected output
    The box will not go on the truck.
    The box goes on the truck.
    The box will not go on the truck.
    The box goes on the truck.
    
  2. Example 2

    Input
    10 10 10 10
    5 5 5
    
    Expected output
    The box goes on the truck.
    
  3. Example 3

    Input
    10 10 10 10
    11 5 5
    
    Expected output
    The box will not go on the truck.