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 }

 

转载于:https://www.cnblogs.com/Crossea/p/11306669.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值