-->
当前位置:首页 > 题库

PROGRAMMING:Carpet

Luz5年前 (2021-05-10)题库508
####Description
In order to prepare for a unique award ceremony, the organizers put some rectangular carpets on a rectangular area of the venue (which can be regarded as the first quadrant of the plane rectangular coordinate system). There are n carpets, numbered from 1 to n. Now these carpets are laid parallel to the coordinate axis in the order of number from small to large, and the latter carpet is covered on the former carpet. After the carpet is laid, the organizer wants to know the number of the top carpet covering a certain point on the ground. Note: points on the border of rectangular carpet and four vertices are also covered by carpet.
Input and output example 1 Description: as shown in the figure below, carpet 1 is represented by solid line, carpet 2 is represented by dotted line, carpet 3 is represented by double solid line, and the top carpet of covering point (2, 2) is carpet 3.
Input and output example 2 Description: as shown in the figure below, carpet 1 is represented by solid line, carpet 2 is represented by dotted line, carpet 3 is represented by double solid line, and the top carpet of covering point (4, 5) is carpet 3.
![ 1423035598.png](~/9bdcbff0-5cb6-45da-968d-8d77bfb397b9.png)
####Input
Enter a total of N + 2 lines.
The first line, an integer n, means that there are n carpets in total.
In the next N lines, the I + 1 line represents the information of the carpet numbered I, which contains four positive integers a, B, G, K. each two integers are separated by a space, which respectively represents the coordinates (a, b) of the lower left corner of the carpet and the length of the carpet in the x-axis and Y-axis directions.
Line n + 2 contains two positive integers x and y, which represent the coordinates (x, y) of the points on the ground.
For 30% of the data, n ≤ 2;
For 50% data, 0 ≤ a, B, G, K ≤ 100;
For 100% data, there are 0 ≤ n ≤ 10000, 0 ≤ a, B, G, K ≤ 100000.
####Output
Output a total of 1 line, an integer that represents the number of the carpet; If it is not covered by carpet, output - 1.
####Sample input
```in
three
1 0 2 3
0 2 3 3
2 1 3 3
2 2
```
####Sample output
```out
three
```
####Sample input
```in
three
1 0 2 3
0 2 3 3
2 1 3 3
4 5
```
####Sample output
```out
-1
```
####Source
The first question of the second round improvement group of noip 2011 (openjudge website), http://noi.openjudge.cn/ch0109/14/






answer:If there is no answer, please comment