| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 29 | 25 | 24 | 88.889% |
Farmer John's cows are participating in the annual Bovington, Wisconsin Cow Parade. The streets in this city form a rectangular grid: they all run north-south or east-west and are equally spaced. Farmer John's cattle parade through the streets.
The cows, being meticulous record keepers, recorded the path of their parade. They wrote exactly a series of D (1 ≤ D ≤ 1,000) directions, such as "north for 3 blocks", then "east for 2 blocks", etc. The distance traveled was always in the range 1..10,000. See the sample data for some of the silly ways the cows recorded their march.
After the parade, the cows wanted to know how many different streets they paraded on. If they paraded on one street, left it, and later paraded on the same street, they only count that street once.
6 N 1 N 4 E 2 S 5 W 2 S 4
4
[The "N 1", "N 4", and "S 4" are all on the same street. The others are on different unique streets.