| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 2048 MB | 68 | 43 | 29 | 59.184% |
The coatis and owls have been at war for a long time already. They are preparing for battle, but given the pandemic, they also want to comply to social distancing. Therefore, they decide to do a digital battle instead, by playing the game Furious Pikemen Combat (FPC) against each other. % Or: Fighting Pikeman Championship
The game features a one-dimensional battlefield. Both players control an army, each consisting of multiple squads of pikemen. The coati army is positioned on the left and the owl army is positioned on the right. During the game, the coati army walks to the right while the owl army walks to the left. When two enemy squads meet, they fight until one of the squads is completely defeated. Since all pikemen are equal in strength, the smaller squad will lose all of its pikemen. The winning squad will lose a number of pikemen depending on the size of the winning squad ($w$) and the size of the losing squad ($l$), equal to $\left\lceil l^2 / w \right\rceil$ (where $\lceil x \rceil$ denotes rounding $x$ up to the nearest integer, or ceiling). If two squads are equal in size, they will fight until both squads are annihilated.
Consider the first sample input as an example. The two squads controlled by the coatis (of 20ドル$ pikemen) walk to the right and the squad controlled by the owls (of 33ドル$ pikemen) walks to the left. When the right-most coati squad meets the owl squad, the coati squad is completely destroyed, while the owl squad loses $\left\lceil 20^2/33 \right\rceil = 13$ pikemen. In other words, the owl squad has 20ドル$ pikemen left. The single remaining squad for both players then consists of exactly 20ドル$ pikemen, so both squads will be annihilated, resulting in a stalemate.
Calculate who wins this digital battle of FPC, and how many pikemen the army of the winning player has left after the battle.
The input consists of:
If all pikemen from both armies are defeated, output "stalemate".
If one player wins the battle, output:
coatis" if the coatis win the battle, or "owls" if the owls win the battle.2 1 20 20 33
stalemate
3 3 10 10 10 20 10 10
owls 19