Chef Teaches His Kid
All submissions for this problem are available.
Yesterday, Chef's Wife taught her Kid to count from 1 to N. Today, Chef wants to test if their Kid can really count from 1 to N. To lure his kid, Chef has told that for every right count his kid will get a candy and for every miss, the kid will lose a candy from candies which he has received. Tell us if kid will get some candies or not. Only if everything goes wrong and Kid couldn't get a candy, Chef's Mom i.e. his Grandma will give him a candy to make him smile.
The first line of the input contains an integer T denoting the number of test cases. Each test case T starts with a number N and number C as mentioned above. Next line contains a list of C numbers which kid counts.
For each test case, output a single line containing number of candies Kid will receive in this challenge.
- 1 ≤ T ≤ 100
- 1 ≤ N ≤ 108+1
- 1 ≤ C ≤ N
- List will contain unique numbers from 1 to N in sorted order
Input: 2 5 5 1 2 3 4 5 5 2 1 3 Output: 5 1
Example Case 2: There is no chance of kid receiving any candy, so his grandma will give him one candy.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, 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, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS|
Fetching successful submissions