305867: CF1101G. (Zero XOR Subset)-less
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
(Zero XOR Subset)-less
题意翻译
题意简述 给出一个序列$\{a_i\}$,试将其划分为尽可能多的非空子段,满足每一个元素出现且仅出现在其中一个子段中,且在这些子段中任取若干子段,它们包含的所有数的异或和不能为$0$. 输入格式 第一行一个整数$n(1 \leq n \leq 2*10^5)$表示序列长度 接下来一行$n$个整数$a_i(0 \leq a_i \leq 10^9)$描述这个序列 输出格式 一行,如果不存在方案输出`-1`,否则输出所有合法的划分方案中最大的划分数题目描述
You are given an array $ a_1, a_2, \dots, a_n $ of integer numbers. Your task is to divide the array into the maximum number of segments in such a way that: - each element is contained in exactly one segment; - each segment contains at least one element; - there doesn't exist a non-empty subset of segments such that bitwise XOR of the numbers from them is equal to $ 0 $ . Print the maximum number of segments the array can be divided into. Print -1 if no suitable division exists.输入输出格式
输入格式
The first line contains a single integer $ n $ ( $ 1 \le n \le 2 \cdot 10^5 $ ) — the size of the array. The second line contains $ n $ integers $ a_1, a_2, \dots, a_n $ ( $ 0 \le a_i \le 10^9 $ ).
输出格式
Print the maximum number of segments the array can be divided into while following the given constraints. Print -1 if no suitable division exists.
输入输出样例
输入样例 #1
4
5 5 7 2
输出样例 #1
2
输入样例 #2
3
1 2 3
输出样例 #2
-1
输入样例 #3
3
3 1 10
输出样例 #3
3