Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- using ll = long long;
- #define pb push_back
- #define pii pair<int,int>
- #define ff first
- #define ss second
- #define mx 100005
- #define endl "\n"
- const ll mod=1e9+7;
- vector<int>mp[550];
- int main()
- {
- ios::sync_with_stdio(0);
- cin.tie(0);
- ll n,m,q;
- cin>>n>>m>>q;
- while(m--)
- {
- ll l,r;
- cin>>l>>r;
- for(int i=1; i<=l; i++)
- mp[i].pb(r);
- }
- for(int i=1; i<=500; i++)
- {
- if(mp[i].size())
- sort(mp[i].begin(),mp[i].end());
- }
- while(q--)
- {
- ll l,r;
- cin>>l>>r;
- /// r ta l er kotho no. position o ase
- ll pos=upper_bound(mp[l].begin(),mp[l].end(),r)-mp[l].begin();
- cout<<pos<<endl;
- }
- return 0;
- }
- // https://www.hackerrank.com/contests/competencia-de-gente-perezosa-round-0-match-0-group-a/challenges/blacknerd-and-his-queries
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement