Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Problemcode:CHEFBDAY
Like
ALLSUBMISSIONS
MYSUBMISSIONS
Share Bethefirstofyourfriendstolikethis.
Chefhasinvitedhisfriendsonhisbirthdayparty.TherearetotalNfriendsthatarecomingathishome.
You are given the arriving and leaving time of each friend andQ queries. Each Query consists of an
integert,youhavetooutputthenumberoffriendsthatarepresentattimetatChef'shome.
Input
ThefirstlinecontainsT,thenumberoftestcases.
The first line of each testcase contain two space separated integers N and Q, then follow N lines
containingtwospaceseparatedintegersaibi,thearrivingandleavingtimeofithfriendrespectively.
NextQlinescontainsasingleintegertaskingthenumberoffriendsatChef'shousepresentattimet.
Output
Foreachquery,outputtherequiredanswerinanewline.
Constraints
1T10
1N100000
1Q100000
1aibi100000
1tmaxofallbi
Example
Input:
1
33
12
22
23
1
2
3
Output:
1
3
SUBMIT