Ainta Game
Time limit1sMemory limit512 MB
Given K, N, and M, decide who wins a game where a piece moves down, right, or diagonally by K on an N by M board, starting from the top-left corner.
- Level
Hard8 of 10
- Topics
- Game theory, Dynamic programming, Math
- Solved
- No attempts yet
Problem
Koosaga and cubelover play the Ainta game. The game starts with one chess piece on an board. The piece is called "Ainta", a piece modeled after Ainta itself. Ainta can move down one square or right one square. Ainta also has an integer written on it, and it can move squares diagonally down and right. In other words, if Ainta is at , it can move in one step to , , or . Ainta cannot move off the board.
At the start, Ainta is on the top-left square. The two players take turns moving Ainta once each. The player who cannot move Ainta any further loses.
Write a program that determines who wins when both players play optimally. Koosaga moves first.
Input
The first line contains the number of test cases (). Each of the next lines contains one test case, consisting of , , and ().
Output
For each test case, print the winner. Print "koosaga" if Koosaga wins, or "cubelover" if cubelover wins.