Igra
의견: 0
Having solved the tedious assignment, Mirko decided to play a game with his good friend Slavko.
They have written a sequence of \(N\) letters on a piece of paper. Each one of them is trying to put together a word using letters from the sequence. They alternate taking turns consisting of removing a single letter from the sequence and appending it to the end of their word. Mirko has the first turn. The game ends when no letters are remaining in the sequence.
We define a word to be more beautiful than another word if it comes first alphabetically. The player who has the more beautiful word at the end of the game wins. If both players have equal words, they both lose.
Mirko is a much better player than Slavko, so he has decided to make it easier for Slavko by always selecting the rightmost remaining letter in the sequence. Knowing this, Slavko wants to find out if it is possible for him to win and which is the most beautiful word he can end the game with.
In test cases worth 50% of total points the number N will not exceed 1000.
The first line of input contains an even positive integer \(N\) (\(2 \le N \le 100\,000\)).
The second line of input contains \(N\) characters, the starting letter sequence. All characters are lower case letters from the English alphabet.
The first line of output must contain DA if it is possible for Slavko to win, and NE otherwise.
The second line of output must contain the most beautiful word that Slavko can have at the end of the game.
Scoring: In test cases worth \(50\%\) of total points the number \(N\) will not exceed \(1000\).
| 서브태스크 | 점수 | 설명 |
|---|---|---|
Test 1 | 10점 | None |
Test 2 | 10점 | None |
Test 3 | 10점 | None |
Test 4 | 10점 | None |
Test 5 | 10점 | None |
Test 6 | 10점 | None |
Test 7 | 10점 | None |
Test 8 | 10점 | None |
Test 9 | 10점 | None |
Test 10 | 10점 | None |
2
neNE
n4
kavaDA
ak8
cokoladaDA
acko평가 및 의견
Igra
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Igra