D. 取石子游戏

    Type: Default 1000ms 256MiB

取石子游戏

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

小Y 和 小N 在玩取石子游戏,规则如下:

一共有偶数堆石子排成一排,每堆石子的个数为 aia_i。两个人轮流取石子,小Y先手。每次取石子只能取最左一堆或最右一堆,且必须取完。最后取得的石子多者获胜。假设双方都足够聪明(虽然.......),最后谁能够获胜呢?

输入格式

第一行输入一个数n 第二行输入n个数

输出格式

输出赢的人,小Y赢则输出Y,小N赢则输出N

4
2 3 3 3
Y

提示

2n1052≤n≤10^5
1ai1051≤ai≤105 ai∑a_i为奇数

0403

Not Attended
Status
Done
Rule
IOI
Problem
6
Start at
2025-4-3 7:30
End at
2025-4-3 12:00
Duration
4.5 hour(s)
Host
Partic.
10