12807 - GPS

All about problems in Volume 128. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

12807 - GPS

Post by brianfry713 »

The sample input:

Code: Select all

2
10 8
+----------+
|          |
|   *****  |
|   *   *  |
| ***   *  |
|       *  |
|     ***  |
|       *  |
|       *  |
+----------+
1 3 7 7
15 15
+---------------+
|***            |
|  *            |
|  *            |
|  *            |
|  ********     |
|      ****     |
|      *****    |
|      ****     |
|        ****   |
|           *   |
|          ***  |
|          * *  |
|          ***  |
|           *   |
|         ******|
+---------------+
0 0 14 14
The sample output:

Code: Select all

Turn to the east.
Continue 2 km.
Turn left.
Continue 2 km.
Turn right.
Continue 4 km.
Turn right.
Continue 6 km.
You have reached your destination.

Turn to the east.
Continue 2 km.
Turn right.
Continue 4 km.
Turn left.
Continue 7 km.
Turn right.
Continue 4 km.
Turn left.
Continue 2 km.
Turn right.
Continue 2 km.
Turn left.
Continue 1 km.
Turn right.
Continue 2 km.
Turn right.
Continue 1 km.
Turn left.
Continue 2 km.
Turn left.
Continue 3 km.
You have reached your destination.

Check input and AC output for thousands of problems on uDebug!
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 12807 - GPS

Post by brianfry713 »

It looks like the input is not formatted according to the problem statement. If you read everything line by line, you will get WA. To get AC I parse all the numbers as tokens, and then the map as lines.
Check input and AC output for thousands of problems on uDebug!
Post Reply

Return to “Volume 128 (12800-12899)”