QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 512 MB Total points: 100

#16482. Odd Occurrence

الإحصائيات

题目描述

Erine 有一个长为 $n$ 的序列 $a$。显然,这个序列有 $2^n-1$ 个非空子序列(如果两个子序列内容相同而位置不同,我们将其看作两个子序列)。

现在 Erine 将所有 $2^n-1$ 个子序列都写在了纸上。写完之后,她希望能将这些子序列整理归类。具体地,Erine 会把内容相同的子序列放进同一个箱子里,内容不同的子序列则一定在不同的箱子里。

然而子序列实在是太多了!不过 Erine 只想知道,将子序列整理归类之后,是否对于每个非空的箱子,里面都恰好有奇数个子序列。

输入格式

本题单个测试点内有多组测试数据

第一行,一个整数 $t$($1 \leq t \leq 10^5$),描述数据组数。对于每组数据:

  • 第一行,一个整数 $n$($1\le n\le 2\times 10^6$)。
  • 第二行,$n$ 个整数 $a_1,a_2,\dots, a_n$($1\le a_i\le n$)。

保证对于单个测试点,所有 $n$ 的和不超过 $2\times 10^6$。

输出格式

对于每组数据输出一行一个字符串 YesNo,表示将子序列整理归类之后,是否对于每个非空的箱子,里面都恰好有奇数个子序列。

样例

样例输入 1

3
3
1 2 1
5
1 1 1 2 3
7
2 2 2 2 2 2 2

样例输出 1

No
Yes
Yes

样例解释

对于第一组数据,装有子序列 $\{1\}$ 的箱子中有 $2$ 个子序列。

对于第二组数据,所有非空的箱子中都恰好有奇数个子序列。

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.