Home > Back-end >  CCF question, why my code only 60 points, a great god help find a hole
CCF question, why my code only 60 points, a great god help find a hole

Time:09-24

Title:
Problem description
In a graphical operating system, there are N window, each window is a rectangular area on both sides parallel to axis respectively, the point on the side of the window also belongs to the window, the window of the difference between a, in more than one window in the overlapping area, will only display on top of the content of the window,
When you click on a point on the screen, you can select the position in the clicked at the top of the window, and the window will be moved to all at the top of the window, and the rest of the window hierarchy order remains the same, if you click on the location of the does not belong to any window, then the system will ignore you click this time,
Now we want you to write a program to simulate click window process,
Input format
Enter the first line of the two positive integers, N and M, (1, N, 1 M or less or less or less 10 or less)
The next N lines in the order from the bottom to the top N is given the position of the window, each row contains four non-negative integer x1, y1, x2, y2, said that the window of a pair of vertex coordinates respectively (x1, y1) and (x2, y2), ensure the x1 & lt; 2 x2, y1,
The next M lines of each row contains two non-negative integers x, y, according to the coordinates of the mouse to click at a time,
Involves all the points in the title and rectangular vertices x, y coordinates does not exceed 2559 and 1439 respectively,
The output format
Output including M lines, each row represents the result of a mouse click, if the time the mouse to click select a window, print the serial number of the window (window according to the order of the input from number 1 to N); If not, then output "IGNORED" (without double quotes),
The sample input
3, 4,
0 0 4 4
1 1 5 5
2 2 6 6
1 1
0 0
4 4
0 5
Sample output
2
1
1
IGNORED
The sample description
First click on the location of the belongs to 1 and 2 at the same time, but due to the second window above, it is selected and placed in the top,
The second click on the location of the only belong to the first window, so the clicks chose this window and to place it in the top floor, window now three hierarchical relationships with initial state on the contrary,
Third click position belongs to the scope of the three Windows at the same time, but due to the first window on top now, it is selected,
Click the (0, 5) does not belong to any window,
My code:
# include
using namespace std;

Int main () {
Int m, n; Cin> M> n;
Int arr [m] [4]; Int BRR [m] [4];
for(int i=0; Ifor(int j=0; J<4. J++) {
Cin> Arr [I] [j];
BRR [I] [j]=arr [I] [j];
}
}
for(int i=0; Iint a,b; int num=0;
Cin> a> b;
For (int j=m - 1; j>=0; J -) {
If (a> [j] [0]=arr & amp; & A<[j] [2]=arr & amp; & B> [j] [1]=arr & amp; & B<=arr [j] [3]) {
For (int g=0; GIf ((arr [j] [0]==BRR [g] [0]) & amp; & [j] [1] (arr==BRR [g] [1]) & amp; & [j] [2] (arr==BRR [g] [2]) & amp; & [j] [3] (arr==BRR [g] [3]))
Cout}
Arr [m - 1] [0]=arr [j] [0]; Arr [m - 1] [1]=arr [j] [1]; Arr [m - 1] [2]=arr [j] [2]; Arr [m - 1] [3]=arr [j] [3];
For (int k=j + 1; KArr (k - 1) [0]=arr [k] [0]; Arr (k - 1) [1]=arr [k] [1]; Arr [k - 1] [2]=arr [k] [2]; Arr [k - 1] [3]=arr [k] [3];
}
num++;
break;
}
}
If (num==0) cout<" IGNORED "& lt; }
}
  • Related