luogu#P7928. [COCI 2021/2022 #1] Kamenčići
[COCI 2021/2022 #1] Kamenčići
Problem Description
Alice and Bob are playing a game again.
In front of them, there are stones in a row. Each stone is either red or blue.
Alice moves first. On each turn, a player chooses one end and takes one stone from that end. Whoever takes red stones first loses.
Assuming both Alice and Bob play optimally, determine who will win in the end.
Input Format
The first line contains two integers .
The next line contains a string of length , consisting only of C and P. C represents a red stone, and P represents a blue stone.
Output Format
If Alice is guaranteed to win, output DA; otherwise, output NE.
4 1
CCCP
DA
8 2
PCPPCCCC
DA
9 1
PPCPPCPPC
NE
Hint
Constraints
For all testdata, , and red stones appear at least times.
| Subtask | Special Constraint | Score |
|---|---|---|
| No special constraints. |
Notes
The total score of this problem is points.
This problem is translated from Croatian Open Competition in Informatics 2021/2022 Contest #1 T2 Kamenčići.
Translated by ChatGPT 5