목차

님 게임 홀짝

ps
링크acmicpc.net/…
출처BOJ
문제 번호11871
문제명님 게임 홀짝
레벨플래티넘 4
분류

스프라그-그런디

시간복잡도O(n)
인풋사이즈n<=100
사용한 언어Python
제출기록30840KB / 72ms
최고기록56ms
해결날짜2022/05/27

풀이

코드

"""Solution code for "BOJ 11871. 님 게임 홀짝".

- Problem link: https://www.acmicpc.net/problem/11871
- Solution link: http://www.teferi.net/ps/problems/boj/11871

Tags: [Sprague-Grundy]
"""


def main():
    M = int(input())  # pylint: disable=unused-variable
    P = [int(x) for x in input().split()]

    grundy = 0
    for p_i in P:
        grundy_i = p_i // 2 + (1 if p_i % 2 else -1)
        grundy ^= grundy_i
    print('koosaga' if grundy else 'cubelover')


if __name__ == '__main__':
    main()