RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00564

Patkice

Unrated 레이팅 미적용
난이도
1s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Not so long ago, in a distant tropical land, there lived three rubber ducks. One hot summer day while they
were lying on the beach, the ducks decided to travel to a nearby island. Since the ducks like adventures,
they decided to travel carried by ocean currents in an old black umbrella.
Since the ducks are experienced ocean explorers, before the voyage they will check out a map of ocean
currents. On the map, the island where the ducks live is marked by a letter ’o’. The ducks can start
their voyage in any of the four directions: north – N, east – E, west – W and south – S.
Ocean currents in these seas move in one of the four directions, and are marked on the map in the following
way: we\(st-ea\)st ’<’, ea\(st-we\)st ’>’, nor\(th-so\)uth ’v’ and sou\(th-no\)rth ’^’. When the ducks are located on
a cell with a current, they will move one cell in the direction of the current. Ocean currents in these seas
are special, as they never lead outside of the map and they don’t form vortexes (places where the ducks
would move in circles if they followed the current).
Calm sea is marked by a dot ’.’. If the currents bring the ducks to a cell with calm sea or back to the
starting island, they won’t be able to continue the voyage. The island that the ducks want to visit is
marked by a letter ’x’.
The ducks don’t want to stop their beach party. They kindly ask you to tell them if it’s possible for them
to get to the other island, and if it is, in which direction should they start their voyage. Since one of
the ducks gets very seasick, they ask you to choose the direction that will make the voyage as short as
possible. If there are multiple directions that yield the same minimal travel time, you should choose the
one that is alphabetically first.

제약

In test cases worth 30 points the valid start direction will be unique if it exists.

입력 형식

The first line contains integers \(r\) and \(s\) (\(3 \le r\), \(s \le 100\)), the number of rows and columns of the map.
Each of the next \(r\) lines contains \(s\) characters from the set ’o<>v^.x’, that represent the map of ocean
currents. There will always be exactly one character ’o’ and exactly one character ’x’ on the map. The
character ’o’ will never be located in the first or last row nor column.

출력 형식

If the ducks can’t reach the other island, print :(.
Otherwise, print :) in the first line. In the second line, print the start direction (N for north, E for east, W
for west or S for south).

예제 1
입력
6 6
..>>>v
.o^..v
.v.<.v
.>>^.v
.x<<<<
......
출력
:)
E
예제 2
입력
5 5
v<<<<
>v.>^
v<.o.
>>v>v
..>>x
출력
:)
S
예제 3
입력
3 3
x>.
.o^
^<.
출력
:(
문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2020/2021 Contest 1

평가 및 의견

Patkice

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Patkice

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8