Submit | All submissions | Best solutions | Back to list |
IAPCR2C - Study Room |
In an algorithm lab class of Aiub there are N number of students and personal computer. All of the computers are arranged in one row. Due to some reason some of the computer are not working properly so students who have good computer are sharing their computer with their adjacent student means a student can only go to one step to his left or right.
You know the number of properly working computer and their position. Print maximum number of student who can use computer.
Input
The first line contains T (1 ≤ T ≤ 60) — the number of test cases.
The first line of each test case contains integer n (1 ≤ n ≤ 105) — the number of student and m (1 ≤ m ≤ n) — properly working computer. The second line contains m integers bi (1 ≤ bi ≤ n) position of ith properly working computer.
Output
Print maximum number of student who can use computer.
Example
Input: 2 6 2 2 5 5 2 2 5 Output: Case 1: 6 Case 2: 5
Added by: | imranziad |
Date: | 2016-06-03 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |
Resource: | Intra AIUB Programming Contest (Mokaddesh Rashid Shovon) |
hide comments
|
|||||
2016-07-27 00:59:16
tutorial stuff!! |
|||||
2016-07-17 18:01:05 Baqir khan
Finally, I am in the "WA because of O/P format" club -_- . Caused me 2 WA |
|||||
2016-07-08 05:44:09
Think Brute Force :) |
|||||
2016-06-17 19:48:26 Umesh Malhotra
Beware of "Case : ". |
|||||
2016-06-15 07:24:32
I m getting right outputs but still wrong answer wtf?? |
|||||
2016-06-14 09:33:12
Don't forget Case %d : like i did :) |
|||||
2016-06-08 05:50:03
its 5 @rayhan50001 |
|||||
2016-06-07 20:50:00
@lalit_nit2 && @shubham9455 answer is 13 or 5??? for lalit_nit2 test case. |
|||||
2016-06-06 06:02:12
Yeah accepted!! Thanks @lalit_nit2 |
|||||
2016-06-05 09:12:23
@shubham9466 1.The position of PC are not always in order->sorting 2.try Test case 1 5 5 1 2 3 4 5 |