Accepted
/usr/bin/ld.bfd: warning: /out/link.res contains output sections; did you forget -T?
代码
var n,i,j,ans,cnt:longint;
a:array[1..100000]of longint;
u:array[1..100000]of boolean;
begin
readln(n);
fillchar(u,sizeof(u),true);
for i:=1 to n do read(a[i]);
for i:=31 downto 0 do begin
cnt:=0;
for j:=1 to n do begin
if (a[j]>>i mod 2=1)and(u[j]) then inc(cnt);
end;
if cnt>=2 then begin
ans:=ans+(1<<i);
for j:=1 to n do
if a[j]>>i mod 2=0 then u[j]:=false;
end;
end;
writeln(ans);
close(input);
close(output);
end.