Cod sursa(job #47084)

Utilizator petrePajarcu Alexandru-Petrisor petre Data 3 aprilie 2007 12:34:04
Problema Xor Max Scor 10
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.61 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 then
                                if j=y then if i>x then x:=i;
m:=m xor a[j];
end;
end;
writeln(g,max,' ',x,' ',y);
close(F);
close(G);
end.