#7377. [ICPC 2024 Chengdu R] Expanding Array
[ICPC 2024 Chengdu R] Expanding Array
[ICPC 2024 Chengdu R] Expanding Array
题目描述
Given an integer array $a_1, a_2, \ldots, a_n$ of length $n$, you can perform any number of operations on this array. In each operation, you can choose two adjacent elements $a_i$ and $a_{i+1}$ ($1 \le irepresents the bitwise AND of and . represents the bitwise OR of and . represents the bitwise XOR (exclusive OR) of and .
输入格式
The first line contains a single integer $n$ ($2 \le n \le 10^5$), representing the length of the array.The second line contains integers (), representing the elements of the array.
输出格式
Output a single integer, representing the maximum number of distinct values that can be obtained in the array after performing any number of operations.2
2 3
4
2
3 4
4