ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

NEERC 2012, Eastern subregional contest

About     Problems     Submit solution     Judge status     Standings
Contest is over

J. Titan Ruins: Transformation of Cylinders

Time limit: 1.0 second
Memory limit: 64 MB
Soren scratched his head thoughtfully. The way forward was blocked by a very powerful magic field. It seemed impossible to get around it, because the corridor hadn't branched for the last three hours. Soren and Alba didn't have enough power to break the field. So they had to find a way to turn it off somehow. There was a small rectangular hole in one of the walls, and it seemed that the flow of magic energy that supported the field was streaming from that hole. It seemed to be a good idea to cover the hole with something.
Alba investigated the objects in the corridor. There was a small hollow cylinder lying beside one of the skeletons. The cylinder induced some strange changes in the magic fields around it. After some experiments, Alba understood that the lateral surface of the cylinder blocked magic energy completely. `This is exactly what we need,' he thought. They could cut out a piece of the surface, straighten it, and cover the hole with it. Looking around, Alba found other hollow cylinders made of the same material. It remained to understand which of the cylinders were large enough to cut out a piece of required size.


The first line contains integers w and h, which are the sizes of the hole in the wall (1 ≤ w, h ≤ 106). In the second line your are given the number n of cylinders (1 ≤ n ≤ 1000). i-th of the following n lines contains two integers Hi and Li — height and circumference of the i-th cylinder (1 ≤ Hi, Li ≤ 106).


Output a line for each of the cylinders: “Block the hole” if a required piece can be cut out from it and “Too small” otherwise.


314 314
314 314
314 313
600 500
234 3456
Block the hole
Too small
Block the hole
Too small
Problem Author: Dmitry Ivankov
Problem Source: NEERC 2012, Eastern subregional contest
To submit the solution for this problem go to the Problem set: 1919. Titan Ruins: Transformation of Cylinders