Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int t,cnt=1;
- scanf("%d",&t);
- while(t--)
- {
- int n,q;
- scanf("%d%d",&n,&q);
- vector<int> seg1(n),seg2(n);
- for(int i=0; i<n; i++)
- {
- scanf("%d%d",&seg1[i],&seg2[i]);
- }
- sort(seg1.begin(),seg1.end());
- sort(seg2.begin(),seg2.end());
- printf("Case %d:\n",cnt++);
- while(q--)
- {
- int x ;
- scanf("%d",&x);
- int low = upper_bound(seg1.begin(),seg1.end(),x)-seg1.begin();
- int start = lower_bound(seg2.begin(),seg2.end(),x)-seg2.begin();
- printf("%d\n",low-start);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement