CF603C.Lieges of Legendre

提高+/省选-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Kevin and Nicky Sun have invented a new game called Lieges of Legendre. In this game, two players take turns modifying the game state with Kevin moving first. Initially, the game is set up so that there are n piles of cows, with the i-th pile containing a__i cows. During each player's turn, that player calls upon the power of Sunlight, and uses it to either:

  1. Remove a single cow from a chosen non-empty pile.
  2. Choose a pile of cows with even size 2·x (x > 0), and replace it with k piles of x cows each.

The player who removes the last cow wins. Given n, k, and a sequence _a_1, _a_2, ..., a__n, help Kevin and Nicky find the winner, given that both sides play in optimal way.

凯文和尼克·孙发明了一款名为“传奇之谎者”(Lieges of Legendre)的新游戏。在该游戏中,两名玩家轮流修改游戏状态,凯文先手。游戏初始状态为 nn 堆奶牛,其中第 ii 堆包含 aia_i 头奶牛。在每名玩家的回合中,该玩家召唤“阳光之力”,并用它执行以下两种操作之一:

  1. 从某一非空堆中移除一头奶牛;
  2. 选择一堆大小为偶数 2⋅x2\cdot x(其中 x>0x > 0)的奶牛,并将其替换为 kk 堆,每堆恰好含 xx 头奶牛。

移除最后一头奶牛的玩家获胜。已知 nn、kk 及序列 a1,a2,…,ana_1, a_2, \dots, a_n,请帮助凯文和尼克判断:在双方均采取最优策略的前提下,谁将获胜?

输入格式

The first line of the input contains two space-separated integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ 109).

The second line contains n integers, _a_1, _a_2, ... a__n (1 ≤ a__i ≤ 109) describing the initial state of the game.

输入的第一行包含两个以空格分隔的整数 nn 和 kk(1 ≤ n ≤ 100 0001 ≤ n ≤ 100\,000,1 ≤ k ≤ 1091 ≤ k ≤ 10^9)。

第二行包含 nn 个整数 a1, a2, ..., ana_1,\,a_2,\,...,\,a_n(1 ≤ ai ≤ 1091 ≤ a_i ≤ 10^9),描述游戏的初始状态。

输出格式

Output the name of the winning player, either "Kevin" or "Nicky" (without quotes).

输出获胜玩家的名字,即“Kevin”或“Nicky”(不带引号)。

输入输出样例

  • 输入#1

    2 1
    3 4

    输出#1

    Kevin
  • 输入#2

    1 2
    3

    输出#2

    Nicky

说明/提示

In the second sample, Nicky can win in the following way: Kevin moves first and is forced to remove a cow, so the pile contains two cows after his move. Next, Nicky replaces this pile of size 2 with two piles of size 1. So the game state is now two piles of size 1. Kevin then removes one of the remaining cows and Nicky wins by removing the other.

在第二个样例中,Nicky 可以按如下方式获胜:Kevin 先手,且被迫移除一头奶牛,因此他的操作后堆中剩余两头奶牛。接着,Nicky 将这个大小为 22 的堆替换成两个大小为 11 的堆。此时游戏状态变为两个大小均为 11 的堆。随后 Kevin 移除其中一头剩余的奶牛,而 Nicky 通过移除另一头奶牛获胜。

输入解题思路,AI测评打分。不知道怎么写?

首页