No.669 Showdown!!! Drinking Contest
タグ : / 解いたユーザー数 203
作問者 :
takeya_okino
/ テスター :
Problem Statement
Tonight, Takeya entered a yakitori restaurant in Shinjuku's "Omoide Yokocho" to have a drink. At this restaurant, it seems you can take part in a drinking contest under the following rules.
・The owner and Takeya take turns drinking sake
・There are N types of sake
・On your turn, choose one type of sake and drink 1 to K (integer) (ml) of it
・Whoever cannot drink sake loses
Note that both the owner and Takeya have a very high tolerance for alcohol, so consider "cannot drink sake" ⇔ "there is no sake left".
Takeya moves first. The amount of each sake is given. Assuming that each player does their best, determine whether Takeya can win this contest.
Output "YES" if Takeya can win, and "NO" if he loses.
(☆) I wish I could have gone to a restaurant called Asadachi in "Omoide Yokocho". It is a place where you can eat so-called bizarre dishes such as raw pig testicle sashimi.
Input
$N$ $K$
$A_1$ $A_2$ $\dots$ $A_{N}$
$1 \leq N \leq 1000$
$1 \leq K \leq 1000$
$0 \leq A_{i} \leq 1000000$
$N$: the number of types of sake
$K$: the maximum amount that can be drunk in $1$ turn. Choose any integer $t$ from the K integers $1, 2, \dots,K$ and drink exactly t (ml)
$A_{i}$: the initial amount (ml) of sake $i$
Output
Assuming that both players do their best, output "YES" if Takeya can win, and "NO" if he loses.
Sample
Sample 1
Input
3 10 0 0 0
Output
NO
There is no sake at all from the start, so he loses. Is the restaurant making fun of him?
Sample 2
Input
5 1 0 0 0 2 0
Output
NO
He obviously loses. Are they making fun of him, or are they really making fun of him?
Sample 3
Input
2 5 11 13
Output
YES
He finally won.
Sample 4
Input
4 30 134 12 500 15000
Output
YES
You two are drinking way too much...
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。