Untitled

 avatar
unknown
plain_text
a year ago
672 B
4
Indexable
#define ll long long
#define pb push_back
#include <bits/stdc++.h>
using namespace std;

void solve(){
    ll n,h,y1,y2,l;
    cin>>n>>h>>y1>>y2>>l;
    vector<pair<ll,ll>>bar(n); //(x,type)
    for(int i=0;i<n;i++){
        cin>>bar[i].second;
        cin>>bar[i].first;
    }
    
    ll res=0;
    for(ll i=0;i<n;i++){
        ll t=bar[i].second;
        ll x=bar[i].first;
        if(t==1 && h-y1>x){
            l--;
        }else if(t==2 && y2<x){
            l--;
        }
        if(l==0) break;
        res++;
    }
    cout<<res<<"\n";
}


signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int t;
	cin>>t;
	while(t--) solve();
}
Editor is loading...
Leave a Comment