Cod sursa(job #54016)

Utilizator petrePajarcu Alexandru-Petrisor petre Data 23 aprilie 2007 21:55:53
Problema Xor Max Scor 25
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.65 kb
var f,g:text;
a:array[1..100000] of longint;
n,i,j,x,y,max,m:longint;
begin
assign(f,'xormax.in');
assign(g,'xormax.out');
reset(F);
rewrite(G);
readln(f,n);
for i:=1 to n do
        read(f,a[i]);
for i:=1 to n do
        begin
m:=a[i];
for j:=i+1 to  n do
begin
        if m xor a[j]>max then
                begin
                max:=m xor a[j];
                x:=i;
                y:=j;
                end
                else if( m xor a[j]=max) and (y>j) then
                begin
                x:=i;
                y:=j;
                end;
m:=m xor a[j];
end;
end;
writeln(g,max,' ',x,' ',y);
close(F);
close(G);
end.