Submit | All submissions | Best solutions | Back to list |
BAT2 - BATMAN2 |
Alfred: "I'll get this to Mr. Fox, but no more. I've sewn you up, I've set your bones, but I won't bury you. I've buried enough members of the Wayne family."
After being promised the software to erase her criminal record, Catwoman agrees to take Batman to Bane. They manage to defeat all of Bane's men but ended up heading into a MAZE trap. Bane would call this maze as the LIS MAZE. He would hide himself in one of the rooms. Each of these rooms have a number (tag) associated with it. The speciality of the maze is that once you enter any room it will only lead you to rooms with a higher tag in the direction you move. Batman and Catwoman decide to move in opposite directions trying their luck to maximize the number of rooms they search. (They can start with any room, need not be the same)
Catwoman: "Never steal from someone you can't outrun, kid."
Input
t, number of testcases.
n, number of rooms.
n integers giving the tag associated with the rooms.
Output
The maximum number of rooms searched.
Constraints
1 ≤ n ≤ 100
Example
Input: 1 6 5 3 4 6 1 2 Output: 5
Added by: | Romal Thoppilan |
Date: | 2013-02-06 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | own problem |
hide comments
|
||||||
2013-07-28 05:03:35 Ahmed Malatawy
@Romal How is the test case correct? If Batman can only move to the right then the maximum would be 3 (3->4->6). Right? |
||||||
2013-06-18 10:01:26 Murukesh Mohanan
Some conditions that aren't immediately obvious to me: 1. Access to any room with a higher tag is allowed, not just adjacent rooms or the next room with a higher tag. 2. Tags are unique. So given the input: 12 11 10 1 2 3 4 13 6 7 8 5 9 the answer is 12: (1,2,3,4,6,7,8,9) and (5,10,11,12). |
||||||
2013-06-14 18:51:30 Murukesh Mohanan
The Test case should be 4, either (3->4->6, 3->5) or (3->4->6,1). |
||||||
2013-06-14 18:00:59 Aayush Tripathi
"Batman can now only move towards right and catwoman to the left" Wont the Test case be 3 ? |
||||||
2013-02-09 13:45:23 :D
Seems to be ok now. Just please do not change the problem again, it's really confusing. It's better to close an old problem and open a new one. |
||||||
2013-02-08 11:41:41 Romal Thoppilan
Batman can now only move towards right and catwoman to the left. |
||||||
2014-02-05 14:45:16 himanshu jain
because qn has been modified Last edit: 2013-02-08 11:33:15 |
||||||
2013-02-08 09:21:30 Ehor Nechiporenko
What has happened? My question comment was removed. And the single solution is also has been changed to WA. Why?! |