301498: CF282E. Sausage Maximization
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Sausage Maximization
题意翻译
给定一个序列,选择一个前缀与一个与之不相交的后缀,使得所有被选择的数的异或和最大。题目描述
The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages! In Bitland a sausage is an array of integers! A sausage's deliciousness is equal to the bitwise excluding OR (the $ xor $ operation) of all integers in that sausage. One day, when Mr. Bitkoch (the local cook) was going to close his BitRestaurant, BitHaval and BitAryo, the most famous citizens of Bitland, entered the restaurant and each ordered a sausage. But Mr. Bitkoch had only one sausage left. So he decided to cut a prefix (several, may be zero, first array elements) of the sausage and give it to BitHaval and a postfix (several, may be zero, last array elements) of the sausage and give it to BitAryo. Note that one or both pieces of the sausage can be empty. Of course, the cut pieces mustn't intersect (no array element can occur in both pieces). The pleasure of BitHaval and BitAryo is equal to the bitwise XOR of their sausages' deliciousness. An empty sausage's deliciousness equals zero. Find a way to cut a piece of sausage for BitHaval and BitAryo that maximizes the pleasure of these worthy citizens.输入输出格式
输入格式
The first line contains an integer $ n $ ( $ 1<=n<=10^{5} $ ). The next line contains $ n $ integers $ a_{1},a_{2},...,a_{n} $ $ (0<=a_{i}<=10^{12}) $ — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
输出格式
Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner.
输入输出样例
输入样例 #1
2
1 2
输出样例 #1
3
输入样例 #2
3
1 2 3
输出样例 #2
3
输入样例 #3
2
1000 1000
输出样例 #3
1000