/ SB域 /

记录详情

Accepted

/usr/bin/ld.bfd: warning: /out/link.res contains output sections; did you forget -T?
# 状态 耗时 内存占用
#1 Accepted 3ms 280.0 KiB
#2 Accepted 49ms 640.0 KiB
#3 Accepted 50ms 512.0 KiB
#4 Accepted 109ms 700.0 KiB
#5 Accepted 107ms 572.0 KiB
#6 Accepted 109ms 612.0 KiB
#7 Accepted 99ms 516.0 KiB
#8 Accepted 107ms 692.0 KiB
#9 Accepted 112ms 716.0 KiB
#10 Accepted 1ms 352.0 KiB

代码

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.

信息

递交者
类型
递交
题目
and 运算
题目数据
下载
语言
Pascal
递交时间
2017-08-22 22:23:36
评测时间
2017-08-22 22:23:36
评测机
分数
100
总耗时
751ms
峰值内存
716.0 KiB