acmsguru |
---|
Закончено |
-1to the output, if there is no solution. Otherwise print the area of Tapochkin's land in square kilometers to the first line, and the path of the fence building machine — to the second. The path of the machine is a sequence of characters "
W", "
N", "
E" and "
S", standing for movements one kilometer "west", "north", "east" or "south" correspondingly. You are allowed to print the path in any direction of driving — clockwise or counterclockwise, as it doesn't really change the closed polyline which the path represents. It there is more than one answer, you may print any of them.
sample input | sample output |
3 4 2 5 6 7 2 9 4 | 13 NENNNEEEESSWWSSWWW |
sample input | sample output |
2 1 -2 -1 2 1 -2 | 5 NWNNNWSSSSEE |
sample input | sample output |
1 1 2 1 2 | 1 ESWN |
Название |
---|