Pagini recente » Cod sursa (job #2896640) | Cod sursa (job #1148438) | Cod sursa (job #1229261) | Cod sursa (job #1611545) | Cod sursa (job #583314)
Cod sursa(job #583314)
var a:array[1..100000]of longint;
n:longint;
procedure init;
var i:longint;f:text;
begin
assign(f,'xormax.in');
reset(f);
readln(n);
for i:=1 to n do read(a[i]);
close(f);
end;
function asdf(x,y:longint):longint;
var i,k:longint;
begin
k:=x;
for i:=x+1 to y do k:=k or a[i];
asdf:=k;
end;
procedure calc;
var i,j,max,x,y,k:longint; f:text;
begin
assign(f,'xormax.out');
rewrite(f);
max:=asdf(1,1); x:=1; y:=1;
for i:=1 to n do
for j:=i to n do
begin
if max<asdf(i,j) then begin max:=k; x:=i; y:=j; end;
end;
writeln(f,max,x,y);
close(f);
end;
begin
init;
calc;
end.