All submissions for this problem are available.
Chef has invited his friends on his birthday party. There are total N friends that are coming at his home. You are given the arriving and leaving time of each friend and Q queries. Each Query consists of an integer t, you have to output the number of friends that are present at time t at Chef's home.
The first line contains T, the number of testcases.
The first line of each testcase contain two space separated integers N and Q, then follow N lines containing two space separated integers ai bi, the arriving and leaving time of ith friend respectively.
Next Q lines contains a single integer t asking the number of friends at Chef's house present at time t.
For each query, output the required answer in a new line.
1 ≤ T ≤ 10 1 ≤ N ≤ 100000 1 ≤ Q ≤ 100000 1 ≤ ai ≤ bi ≤ 100000 1 ≤ t ≤ max of all bi
Input: 1 3 3 1 2 2 2 2 3 1 2 3 Output: 1 3 1
|Time Limit:||0.5 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions