QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 512 MB مجموع النقاط: 100 قابلة للهجوم ✓

#17356. Lovely String (Easy Version)

الإحصائيات

这是本题的简单版本。简单版本和困难版本的唯一区别在于所求内容。

Yuki 是一个文学家!

她定义一个仅包含小写字母的字符串是 lovely 的,当且仅当:

  • 该字符串中出现正奇数次的字符的数量为偶数。
  • 该字符串中出现正偶数次的字符的数量为奇数。

例如,$\texttt{lovely}$ 和 $\texttt{milmon}$ 是 lovely 的,而 $\texttt{dxqwq}$ 和 $\texttt{cocoly}$ 不是 lovely 的。

现在,Yuki 有一个长度为 $n$ 的仅包含小写字母的字符串 $s$。你需要帮助她判断 $s$ 是否是 lovely 的。

输入格式

本题包含多组测试数据。

第一行包含一个正整数 $t\ (1 \le t \le 10^5)$,表示测试数据组数。

对于每组测试数据:

  • 第一行包含一个正整数 $n\ (1 \le n \le 5\cdot10^5)$。
  • 第二行包含一个长度为 $n$ 的字符串 $s$。

保证字符串 $s$ 中仅包含小写字母,保证所有测试数据中 $n$ 的总和不超过 $5 \cdot 10^5$。

输出格式

对于每组测试数据,输出一行:

  • 若 $s$ 是 lovely 的,则输出一个字符串 $\texttt{Yes}$。
  • 若 $s$ 不是 lovely 的,则输出一个字符串 $\texttt{No}$。

输出时不区分大小写。例如,$\texttt{YES}$、$\texttt{yes}$ 和 $\texttt{yEs}$ 都会被认为是正确的回答。

样例输入

8
5
hello
6
lovely
6
milmon
5
dxqwq
6
cocoly
6
qingyu
9
coffeezzz
6
byebye

样例输出

No
Yes
Yes
No
No
No
No
Yes

样例解释

对于第 $1$ 组测试数据:

  • $\texttt{hello}$ 中出现正奇数次的字符的数量为 $3$,出现正偶数次的字符的数量为 $1$,因此 $\texttt{hello}$ 不是 lovely 的。

对于第 $2$ 组测试数据:

  • $\texttt{lovely}$ 中出现正奇数次的字符的数量为 $4$,出现正偶数次的字符的数量为 $1$,因此 $\texttt{lovely}$ 是 lovely 的。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.