We dont fall outnumber in battlefield
All submissions for this problem are available.
Decepticons are quiet clever and strong. Megatron was behind the cube called “All Spark” which was lost. Only few pieces remained which were too powerful to be kept together at one place. Thus all the pieces were scattered across the world, so that their energy could be minimized. But in the battle with Decepticons, Autobots need a source of energy that can continuously supply them energy to fight the battle. They are helped by the human army in the battle. Thus they need to go to the sites where pieces are placed to repower themselves. All of them cannot leave the battle field altogether. So they stay at the battle field for a fixed duration and after that leave to repower. The army chief is monitoring the time they enter the field and the time they leave the field. By doing this he is capable to know that how many autobots are simultaneously in the battlefield to fight against the Decepticons. Note that if one autobot arrives at the same time another leaves, they are never considered to be in the battlefield.
Input an integer N, the number of autobots. Two lines follow, each with exactly N positive integers. The i-th integer of the first line is the arrival time of the i-th autobot, and the i-th integer of the second line is the departure time of the i-th autobot (which will be strictly greater than the arrival time).
For each test case, print the maximum number of autobots that are simultaneously at the hotel.
Input: 5 1 2 3 18 20 2 3 21 19 21 Output: 2 Input: 4 4 5 6 7 5 6 7 8 Output: 1
|Time Limit:||0.2 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, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.