Send your feedback or ask for help here!
I don’t understand the test 02 which indicates 11 seconds whereas I would have thought of 20, which is the total number of persons ‘R’.
Since there is only one exit for each direction, we cannot have less than the number of people for each direction, as only one person exits at each exit.
Unless I missed something?
I haven’t solved this yet, but my understanding is that you can exit in any direction in any lane, according to your movement direction.
So for test case 02:
- In the first 10 seconds, everyone in the upper lane exits to the right, in order.
- From the lower lane, the rightmost 9 people cannot change lane, so they will also exit in the first 9 seconds to the right, in order.
- However, the lower leftmost pedestrian can and will change lane in the first second. Thus, (s)he will leave only in the 11th second (at upper right exit).
Okay, I understand now. In fact, I’ve created a constraint that does not exist: a person ‘R’ can also leave the lower line by the right (the indication “exit” on the upper line only induced me this non-existent constraint).
Thanks for the detail.
I have a question to the given rule set which seems I didn’t understand properly which leads to failing example 07.
my understanding of the rules is that everyone first tries to get to their own lane, therefore the ‘L’ in the upper Lane tries to go down but is blocked by the ‘L’. The same for the ‘R’ in the lower lane. But the 'L’s in the lower lane, as well the 'R’s in the upper lane, cannot move forward as they are blocked by the ‘R’ or ‘L’ going in the opposite direction. So everyone who is on the right lane cannot move, and the one on the wrong lane cannot move as well, therefore I thought this would be a congestion but expected was “9” as answer.
Unfortunately every other testcase was successful and I couldn’t track my misunderstanding of the rules. Could someone help me out here?
Thanks in advance.
Look at the rule 6
People can move to a space that was opened up due to someone else moving during the current second (for example, two people directly above and below each other can swap lanes)
Name of the test case is also a clue
Everybode moves at the same time and the lanes after 1 second look like this:
Basically there can be a “cyclic” permutation of people as long as no one moves where someone with higher priority wants to move.
ah. I didn’t think that far given the parallelism. thank you that helped a lot!