problem: (C) Vladik and Memorable Trip Solution In C/C++ Archive

Codeforces Round #416 (Div. 2), problem: (C) Vladik and Memorable Trip Solution In C/C++

Codeforces Round #416 (Div. 2), problem: (C) Vladik and Memorable Trip Solution In C/C++

#include<cstdlib> #include<cstring> #include<iostream> #include<algorithm> #include<cstdio> using namespace std; int main(){ int n,a,c,f; scanf(“%d”,&n); for(int i=0;i<n;i++)scanf(“%d”,a+i),c]++; for(int i=0;i<n;i++){ int v={0},temp=0,xo=0; for(int j=i;j>=0;j–){ if(v]==0)v]=1,temp+=c],xo^=a; f=max(f,f+(–temp?0:xo)); } } printf(“%d”,f); return 0; }