F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

ZCC loves cards

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 3693    Accepted Submission(s): 905


Problem Description
ZCC loves playing cards. He has n magical cards and each has a number on it. He wants to choose k cards and place them around in any order to form a circle. He can choose any several consecutive cards the number of which is m(1<=m<=k) to play a magic. The magic is simple that ZCC can get a number x=a1¨’a2...¨’am, which ai means the number on the ith card he chooses. He can play the magic infinite times, but once he begin to play the magic, he can¡¯t change anything in the card circle including the order.
ZCC has a lucky number L. ZCC want to obtain the number L~R by using one card circle. And if he can get other numbers which aren¡¯t in the range [L,R], it doesn¡¯t matter. Help him to find the maximal R.
 

Input
The input contains several test cases.The first line in each case contains three integers n, k and L(k¡Ün¡Ü20,1¡Ük¡Ü6,1¡ÜL¡Ü100). The next line contains n numbers means the numbers on the n cards. The ith number a[i] satisfies 1¡Üa[i]¡Ü100.
You can assume that all the test case generated randomly.
 

Output
For each test case, output the maximal number R. And if L can¡¯t be obtained, output 0.
 

Sample Input
4 3 1 2 3 4 5
 

Sample Output
7
 

Hint
¨’ means xor
 

Author
Õòº£ÖÐѧ
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-03 08:34:30, Gzip enabled