All submissions for this problem are available.
A team of robbers have entered the premises of the Bank of Chefland. The bank consists of a long corridor, with N cameras fitted along the corridor. To prevent being seen in the cameras, the robbers will generate K electric surges to disable the cameras. If a surge is generated between distance A and B (measured from one end of the corridor), then all cameras in the inclusive range get disabled.
Given the locations of the cameras and the region affected by each surge, print the total number of cameras disabled. All coordinates are measured from one end of the corridor.
First line consists of two space-separated integers, N and K
Next line contains N space-separated integers, where the ith integer Ci indicated the coordinate of the ith camera.
Each of the next K lines contains two integers. ith line contains integers Ai and Bi indicating the region affected by the ith surge.
Print a single integer, indicating the total number of cameras disabled by the surges.
SAMPLE INPUT2 3
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, 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, CLOJ, FS|
Fetching successful submissions