Computer Science Canada

Round 2 Q5

Author:  coolgod [ Wed Nov 28, 2012 4:59 pm ]
Post subject:  Round 2 Q5

Just asking for a clarification
"No guard can see past a car" the question said
so in test case 2, if a guard is on top of car #3 can he see if someone is on top of car #4?

Author:  Tony [ Wed Nov 28, 2012 5:11 pm ]
Post subject:  RE:Round 2 Q5

Quote:

5 2
2
1
3
4
1

if a guard is on top of car of heigh 3, he can see if someone is on top of car of height 4, but not past a car, that is -- guard can't see if anyone is on top of the last car (5th entry, height 1).

The question has a note about it
Quote:

Notes: in the first case, a single guard can be placed on the middle car, and the range of 2 in each direction will cover the entire lot. In the second case, such strategy will not work, as a guard in the middle (height 3) is blocked by the following car (height 4) from monitoring the last car of the lot.


: