You have decided to make an apple pie. For this you need howMany apples. You are going to gather the apples from your garden. An apple can only be gathered once it falls on the ground. Unfortunately, you discovered that some apples are going to fall on your neighbors' garden, because your tree has grown out of your garden's bounds.
Given the exact coordinates where each apple falls (x[i] and y[i] are the coordinates for the i-th apple), and the exact day when it will fall (day[i] is the day for the i-th apple), determine the day on which you will have all the apples you need to make your pie. If it's impossible to gather howMany apples, return -1.
Your garden is a rectangle with corners (0,0), (0,100), (100,100) and (100,0). If an apple falls within, or on the border of your garden, you can gather it. Apples that fall outside your garden belong to your neighbors. |