CF549C.The Game Of Parity

提高+/省选-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

There are n cities in Westeros. The i-th city is inhabited by a__i people. Daenerys and Stannis play the following game: in one single move, a player chooses a certain town and burns it to the ground. Thus all its residents, sadly, die. Stannis starts the game. The game ends when Westeros has exactly k cities left.

The prophecy says that if the total number of surviving residents is even, then Daenerys wins: Stannis gets beheaded, and Daenerys rises on the Iron Throne. If the total number of surviving residents is odd, Stannis wins and everything goes in the completely opposite way.

Lord Petyr Baelish wants to know which candidates to the throne he should support, and therefore he wonders, which one of them has a winning strategy. Answer to this question of Lord Baelish and maybe you will become the next Lord of Harrenholl.

维斯特洛大陆上有 nn 座城市。第 ii 座城市居住着 aia_i 人。丹妮莉丝与史坦尼斯进行如下游戏:在单次操作中,一名玩家选择某座城市并将其彻底焚毁,该城所有居民(令人遗憾地)全部死亡。史坦尼斯先手。当维斯特洛仅剩下恰好 kk 座城市时,游戏结束。

预言指出:若幸存居民总数为偶数,则丹妮莉丝获胜——史坦尼斯将被斩首,丹妮莉丝登上铁王座;若幸存居民总数为奇数,则史坦尼斯获胜,一切发展完全相反。

培提尔·贝里席大人想知道他应当支持哪位王位候选人,因此他好奇:二人中究竟谁拥有必胜策略?请回答贝里席大人的这一问题,或许你将成为下一任赫伦堡伯爵。

输入格式

The first line contains two positive space-separated integers, n and k (1 ≤ k ≤ n ≤ 2·105) — the initial number of cities in Westeros and the number of cities at which the game ends.

The second line contains n space-separated positive integers a__i (1 ≤ a__i ≤ 106), which represent the population of each city in Westeros.

第一行包含两个用空格分隔的正整数 nn 和 kk(1 ≤ k ≤ n ≤ 2⋅1051 ≤ k ≤ n ≤ 2·10^5)—— 分别表示维斯特洛初始的城市数量以及游戏结束时剩余的城市数量。

第二行包含 nn 个用空格分隔的正整数 aia_i(1 ≤ ai ≤ 1061 ≤ a_i ≤ 10^6),表示维斯特洛每座城市的人口数量。

输出格式

Print string "Daenerys" (without the quotes), if Daenerys wins and "Stannis" (without the quotes), if Stannis wins.

如果丹妮莉丝获胜,则输出字符串 “Daenerys”(不带引号);如果史坦尼斯获胜,则输出字符串 “Stannis”(不带引号)。

输入输出样例

  • 输入#1

    3 1
    1 2 1

    输出#1

    Stannis
  • 输入#2

    3 1
    2 2 1

    输出#2

    Daenerys
  • 输入#3

    6 3
    5 20 12 7 14 101

    输出#3

    Stannis

说明/提示

In the first sample Stannis will use his move to burn a city with two people and Daenerys will be forced to burn a city with one resident. The only survivor city will have one resident left, that is, the total sum is odd, and thus Stannis wins.

In the second sample, if Stannis burns a city with two people, Daenerys burns the city with one resident, or vice versa. In any case, the last remaining city will be inhabited by two people, that is, the total sum is even, and hence Daenerys wins.

在第一个样例中,史坦尼斯将使用他的操作烧毁一座有两人的城市,而丹妮莉丝将被迫烧毁一座只有一名居民的城市。唯一幸存的城市将剩下一名居民,即总人数为奇数,因此史坦尼斯获胜。

在第二个样例中,若史坦尼斯烧毁一座有两人的城市,则丹妮莉丝将烧毁那座只有一名居民的城市;反之亦然。无论哪种情况,最后剩下的城市都将有两名居民,即总人数为偶数,因此丹妮莉丝获胜。

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

首页