Submit | All submissions | Best solutions | Back to list |
XMAX - XOR Maximization |
Given a set of integers S = { a1, a2, a3, ... a|S| }, we define a function X on S as follows:
X( S ) = a1 ^ a2 ^ a3 ^ ... ^ a|S|.
(^ stands for bitwise 'XOR' or 'exclusive or')
Given a set of N integers, compute the maximum of the X-function over all the subsets of the given starting set.
Input
The first line of input contains a single integer N, 1 <= N <= 105.
Each of the next N lines contain an integer ai, 1 <= ai <= 1018.
Output
To the first line of output print the solution.
Example
Input:
3
1
2
4
Output:
7
Added by: | gustav |
Date: | 2011-01-26 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | classical problem |
hide comments
|
||||||
2017-05-13 14:46:21
Use [spoiler]..similar problem on codechef Last edit: 2017-09-24 00:38:23 |
||||||
2017-01-04 08:37:37
very strict time_limit , but good question finally ac :) |
||||||
2016-08-14 19:10:05
may i get any critical case? |
||||||
2016-06-08 10:57:07 [Mayank Pratap]
My 287th problem :) |
||||||
2016-04-23 22:41:31 Alex Abbas
Stick to c++ guys because Input is not formatted properly. |
||||||
2016-03-09 04:43:42 minhthai
not easy at all :( |
||||||
2015-09-11 16:14:19 Pratik S
are single element subsets accepted? i.e what is the output for:- 3 1 2 7 Is it 7 or 6? |
||||||
2015-04-08 14:43:41 Nishant Gupta
nice one :) my 450th on spoj :D |
||||||
2014-12-25 05:43:04 Tejas Sudhir Niphadkar
@cc, no it is 3. |
||||||
2014-12-16 13:54:06 RUDRA
I think test cases are weak.(I don't know why!!!) anyone of you realising the same thing??!! |