T500971 「FSLOI Round I」Stone

题目背景

**[Chinese statement.](https://www.luogu.com.cn/problem/T460363?contestId=163361) You must submit your code at the Chinese version of the statement.** Frank and Louis are playing a modified version of an ancient game.

题目描述

Frank and Louis are playing a game with $n$ piles of stones, where the $i$-th pile has $a_i$ stones. Denote the average of sequence $a_1,a_2,\dots,a_n$ as $x$. Before the game starts, a positive integer not greater than $x$ is given. Frank and Louis take turns making the following moves with Frank going first: - Choose the $i$-th and the $j$-th piles of stones $(i \neq j)$ satisfying $a_i

输入格式

输出格式

说明/提示

**Example Explanation** In the first example, $a$ is initially $\{1,5,7,9,13\}$, and the average value $x$ of the sequence $a$ is $7$. One possible game process follows: 1. Frank chooses $i=1,j=5$, and $a$ becomes $\{3,5,7,9,11\}$. 2. Louis chooses $i=1,j=4$, and $a$ becomes $\{5,5,7,7,11\}$. 3. Frank chooses $i=2,j=5$, and $a$ becomes $\{5,7,7,7,9\}$. 4. Louis chooses $i=1,j=5$, and $a$ becomes $\{7,7,7,7,7\}$. 5. Frank is unable to make a move, so Louis wins. **Constraints** **Subtasks are used in this problem.** For all tests, it is guaranteed that: - $1 \le T \le 10$ - $1 \le n \le 2 \times 10^5$ - $0 \le a_i \le 10^9$ - $1 \le k \le x$ - $x$ is an integer. | Subtask Id | Score | Special Property | | :----: | :--: | :---------: | | $1$ | $5$ |$A$| | $2$ | $10$ | $k=1$ | | $3$ | $15$ | $n \le 5, T=1$| | $4$ | $25$ | $n \le 1000$ | | $5$ | $45$ | - | Special Property A: $a_1=a_2=\dots=a_n$.