2018北航预推免机试 T2 激活窗口

题意:

输入输出用例:

4
1 43 31 70 56
2 50 24 80 50
3 23 13 63 42
4 57 36 90 52
4
47 28
73 40
68 32
82 43

4 2 3 1

代码:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7;

int n;
pair<
    pair<int,int>,
    pair<
        pair<int,int>, pair<int,int>
    >
> win[1010];
int k;

int main(){
    ios::sync_with_stdio(false);
    cin>>n; for(int i=0; i<n; ++i)
        win[i].first.first=i, cin>>win[i].first.second,
            cin>>win[i].second.first.first>>win[i].second.first.second
            >>win[i].second.second.first>>win[i].second.second.second;
    cin>>k;
    while(k--){
        int x, y; cin>>x>>y;
        sort(win, win+n);
        for(int i=0; i<n; ++i){
            if(win[i].second.first.first<=x && x<=win[i].second.second.first &&
                    win[i].second.first.second<=y && y<=win[i].second.second.second){
                win[i].first.first=0;
                for(int j=0; j<i; ++j) win[j].first.first=j+1;
                break;
            }
        }
    }
    sort(win, win+n);
    for(int i=0; i<n; ++i) cout<<win[i].first.second<<" ";
}
posted @ 2022-07-07 22:46  MoonOut  阅读(83)  评论(0)    收藏  举报