목차

님 게임

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

게임이론

시간복잡도O(n)
인풋사이즈n<=100
사용한 언어Python 3.11
제출기록34248KB / 80ms
최고기록40ms
해결날짜2023/06/17

풀이

코드

"""Solution code for "BOJ 11694. 님 게임".

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

Tags: [game theory]
"""

import functools
import operator


def main():
    N = int(input())
    P = [int(x) for x in input().split()]
    if max(P) == 1:
        print('koosaga' if N % 2 == 0 else 'cubelover')
    else:
        grundy = functools.reduce(operator.xor, P)
        print('koosaga' if grundy != 0 else 'cubelover')


if __name__ == '__main__':
    main()