Pagini recente » Cod sursa (job #1861508) | Cod sursa (job #2478535) | Cod sursa (job #2654117) | Cod sursa (job #801644) | Cod sursa (job #1313646)
#include<fstream>
#include<vector>
using namespace std;
ifstream fin("xormax.in");
ofstream fout("xormax.out");
vector<long long> V;
long long n, elem, xormax, b, e, SUM;
int main() {
fin>>n;
for(int i=1; i<=n; i++) {
fin>>elem;
V.push_back(elem);
}
for(int i=0; i<n; i++) {
SUM = 0;
for(int j=i; j<n; j++) {
SUM ^= V[j];
if(SUM > xormax) {
xormax = SUM;
b = i;
e = j;
}
}
}
fout<<xormax<<" "<<b+1<<" "<<e+1;
return 0;
}