CSES - Maximum Xor Subarray | Đoạn con có xor lớn nhất

View as PDF



Problem types
Points: 1600 (p) Time limit: 1.0s Memory limit: 512M Input: stdin Output: stdout

Cho một mảng gồm \(n\) số nguyên, nhiệm vụ của bạn là tìm đoạn con có tổng xor lớn nhất.

Input

  • Dòng đầu vào đầu tiên có một số nguyên \(n\): kích thước của mảng.
  • Dòng tiếp theo có \(n\) số nguyên \(x_1, x_2, \dots, x_n\): nội dung của mảng.

Output

  • In một số nguyên: tổng xor lớn nhất của một đoạn con.

Constraints

  • \(1 \le n \le 2 \cdot 10^5\)
  • \(0 \le x_i \le 10^9\)

Example

Sample input

4
5 1 5 9

Sample output

13

Comments

There are no comments at the moment.