This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<cstdio>
int N;
int max=0;
int arr[15];
int X[15],Y[15];
int Xp,Yp;
void btrack(int,int);
int main(){
int i;
scanf("%d",&N);
for(i=0;i<N;i++) scanf("%d",&arr[i]);
btrack(0,0);
btrack(0,1);
printf("%d",max);
return 0;
}
void btrack(int nItem,int flag){
if(nItem==N){
int XOR_X=X[0],XOR_Y=Y[0];
int i;
for(i=1;i<Xp;i++){
XOR_X^=X[i];
}
for(i=1;i<Yp;i++){
XOR_Y^=Y[i];
}
if(X[i]==Y[i]){
if(max<X[i]) max=X[i];
}
return;
}
if(flag==0){
X[Xp++]=arr[nItem];
btrack(nItem+1,0);
btrack(nItem+1,1);
Xp--;
}
if(flag==1){
Y[Yp++]=arr[nItem];
btrack(nItem+1,0);
btrack(nItem+1,1);
Yp--;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |