csp 201403-2
代码:
1 #include<iostream> 2 using namespace std; 3 int wind[11];//记录的是当前窗口在哪个顺序 4 int n,m,x,y; 5 struct area{ 6 int x1; 7 int y1; 8 int x2; 9 int y2; 10 }; 11 12 area a[11]; 13 14 bool inarea(int i,int x,int y) 15 { 16 return x>=a[i].x1&&x<=a[i].x2&&y>=a[i].y1&&y<=a[i].y2; 17 } 18 19 void totop(int c) 20 { 21 wind[0]=wind[c]; 22 for(int i=c;i>=1;i--) 23 wind[i]=wind[i-1]; 24 } 25 int main() 26 { 27 cin>>n>>m; 28 for(int i=1;i<=n;i++) 29 { 30 wind[n-i+1]=i; 31 cin>>a[i].x1>>a[i].y1>>a[i].x2>>a[i].y2; 32 } 33 int j; 34 while(m--) 35 { 36 cin>>x>>y; 37 for(j=1;j<=n;j++) 38 { 39 if(inarea(wind[j],x,y)) 40 break; 41 } 42 //cout<<j<<"gg"<<endl; 43 if(j==n+1) 44 cout<<"IGNORED"<<endl; 45 else 46 { 47 cout<<wind[j]<<endl; 48 totop(j); 49 } 50 } 51 return 0; 52 }
一条有梦想的咸鱼