시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 512 MB | 46 | 12 | 12 | 27.273% |
Dia and Ruby take turns playing a game using an n x n square chocolate bar. Each turn, the current player must do one of the following (Ruby will go first):
The player who eats up the last chocolate square wins. Initially, some squares on the chocolate bar are already eaten. If both players play optimally, who will win the game? Note: “optimally” means if any player has a strategy to win no matter how their opponent responds, they will take that move – optimizing their chance of winning.
Input consists of multiple lines. The first line contains a single integer, n, (1 ≤ n ≤ 2000) which gives the dimensions of the chocolate bar and indicates there are n lines of data that follow that describe the chocolate bar.
Each line contains n characters consisting of X
(indicating an empty square) or –
(indicating a chocolate square).
The output line consists of the word RUBY
if Ruby is the winner or DIA
if Dia is the winner.
4 ---- ---X ---- XXXX
RUBY