标签:
窗口
Description
Input
Output
Sample Input
Sample Output
Hint
#include<iostream> #include<algorithm> using namespace std; struct window{ int x1,y1; int x2,y2; int id; }; void swap(window &a,window &b) { window t; t.x1=a.x1;t.y1=a.y1;t.x2=a.x2;t.y2=a.y2;t.id=a.id; a.x1=b.x1;a.y1=b.y1;a.x2=b.x2;a.y2=b.y2;a.id=b.id; b.x1=t.x1;b.y1=t.y1;b.x2=t.x2;b.y2=t.y2;b.id=t.id; } window w[12]; void Adjust(window w[],int n,int x) { for(int i=x;i<n;i++) swap(w[i],w[i+1]); } int main() { int n,m,ans; while(cin>>n>>m) { ans=0; for(int i=1;i<=n;i++) { cin>>w[i].x1>>w[i].y1>>w[i].x2>>w[i].y2; w[i].id=i; } for(int i=0;i<m;i++) { int a,b,j; cin>>a>>b; for(j=n;j>0;j--) { if(a>=w[j].x1 && a<=w[j].x2 && b>=w[j].y1 && b<=w[j].y2) { Adjust(w,n,j); break; } } if(j==0) cout<<"IGNORED"<<endl; else cout<<w[n].id<<endl; } } return 0; }
标签:
原文地址:http://www.cnblogs.com/wixy/p/5492332.html