Luo Gu P1830 bombing III

 

Topic background

X was the size of a bombing for the city of N * M, each time the bombing of a rectangle with each side of the boundary are parallel.

Title Description

After the bombing, there is a key point Y, commander wanted to know, they have not been subjected to bombing, if any, was bombed several times, the last time was the first rounds.

Input Format

The first row, four integer: n, m, x, y.

The following x rows of four integers: x1, y1, x2, y2, bombed rectangle represents the top left coordinates and lower right coordinates (such as 13,710 where it is expressed from the bombed (1,3) to (7,10) of the rectangle).

Then the y lines of two integers, a graph of the critical point.

Output Format

Total row y,

The first character of each line is Y or N, indicating whether the bombing, if it is Y, after a space for the two integer representing the bombed several times and the last time was the first rounds.

Sample input and output

Input # 1
10 10 2 3
1 1 5 5
5 5 10 10
3 2
5 5
7 1
Output # 1
Y 1 January 
and 2 February 
N

Description / Tips

Data is weak! ! ! Direct simulation! ! ! !

1<=N,M<=100

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 int main()
 4 {
 5     int x,y,n,m,q,w,x1[101],y1[101],x2[101],y2[101];
 6     cin>>n>>m>>q>>w;
 7     for(int i=1;i<=q;i++)
 8     {
 9         cin>>x1[i]>>y1[i]>>x2[i]>>y2[i];
10     }
11     int s=0,l=0,k=0;
12     for(int i=1;i<=w;i++)
13     {
14         s=0;
15         l=0;
16         k=0;
17         cin>>x>>y;
18         for(int j=1;j<=q;j++)
19         {
20             if(x>=x1[j]&&x<=x2[j]&&y>=y1[j]&&y<=y2[j]&&s==0)
21             {
22                 cout<<"Y";
23                 s=1;
24             }
25             if(x>=x1[j]&&x<=x2[j]&&y>=y1[j]&&y<=y2[j])
26             {
27                 k++;
28                 l=j;
29             }
30         }
31         if(s==1) cout<<k<<' '<<l<<endl;
32         else cout<<"N"<<endl;
33     }
34     return 0;
35 }

Guess you like

Origin www.cnblogs.com/anbujingying/p/11317660.html