Coatis and Owls
시간 제한2초메모리 제한2048 MB
양쪽 끝에서 분대가 만나는 과정을 규칙에 따라 시뮬레이션하며, 한쪽 군대가 전멸하거나 무승부가 될 때까지 진행한다.
문제
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 () and the size of the losing squad (), equal to (where denotes rounding 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 pikemen) walk to the right and the squad controlled by the owls (of 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 pikemen. In other words, the owl squad has pikemen left. The single remaining squad for both players then consists of exactly 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:
- A line with two integers and (), the number of squads controlled by the coatis and the owls, respectively.
- A line with integers (), where each indicates the size of one squad of pikemen.
출력
If all pikemen from both armies are defeated, output "stalemate".
If one player wins the battle, output:
- A line containing either "
coatis" if the coatis win the battle, or "owls" if the owls win the battle. - A line with the number of pikemen remaining in the army of the winning player.