Picking the best hotel

Picking hotels is sometimes very time-consuming. That’s why you’ve decided to write a program that would help you narrow down the search. You know that there are n hotels in general. You know their distance from the city center and the cost. You either want a hotel that is very far away from the city center and is not expensive or a hotel that is in the city center.
  • You’ve decided that you’d consider the hotel in the city center if its distance from the central square is ≤ 100.
  • You’ve decided that the hotel is far from the city if its distance is ≥ 1000.
  • The hotel is considered cheap if the price is less than 40 per night.
The first line of the input contains a single integer n - the number of hotels. The next lines have the following structure, first comes the name of the hotel, then the distance from the central square, then its price.
The output of the program should contain a list of hotels that satisfy your needs, each on a separate line, following the order in which they appear in the input.
Input
Output
3 Waves 5000 30 Central 10 1000 Rocks 1500 50
Waves Central
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue