/ SB域 /

记录详情

Memory Exceeded

/usr/bin/ld.bfd: warning: /out/link.res contains output sections; did you forget -T?
# 状态 耗时 内存占用
#1 Accepted 1ms 840.0 KiB
#2 Accepted 36ms 20.5 MiB
#3 Accepted 2ms 872.0 KiB
#4 Accepted 2ms 860.0 KiB
#5 Accepted 1ms 840.0 KiB
#6 Accepted 2ms 884.0 KiB
#7 Accepted 2ms 848.0 KiB
#8 Accepted 2ms 768.0 KiB
#9 Memory Exceeded ≥323ms ≥125.0 MiB
#10 Memory Exceeded ≥282ms ≥125.0 MiB

代码

var a,b,c,s,p,i,j,cnt,kk:longint;
    w:array[0..655360,1..160]of integer;
    u:array[0 ..655360]of boolean;
    ans:array[0..1600]of char;    t:array[1..16]of longint;
procedure swap(var a,b:longint);
var
t:longint;
begin
 t:=a; a:=b; b:=t;
end;
procedure f(s,p:longint);
var len,i:longint;

begin
 len:=0;
 fillchar(t,sizeof(t),0);
 // write(s,'=');
 while s>=1 do begin
  inc(len);
  if s mod 2=0 then t[len]:=0
       else t[len]:=1;
  s:=s div 2;
 end;
 for i:=1 to 16 div 2 do
  swap(t[i],t[16-i+1]);
 for i:=1 to 16 do w[p,i]:=t[i];

end;
begin
 readln(a,b,c,s);
 fillchar(u,sizeof(u),false);
 u[s]:=true;
 p:=1;
 f(s,p);
 while true do begin
   s:=(a*s+b) mod c;
   if u[s] then break;
   inc(p);
   f(s,p);
 end;
 for i:=1 to 16 do begin
  cnt:=0;
  for j:=1 to p do begin
  cnt:=cnt+w[j,i];
  end;
  inc(kk);
  if cnt=0 then ans[kk]:='0'
  else if cnt=p then ans[kk]:='1'
  else ans[kk]:='?'
 end;
 for i:=1 to kk do write(ans[i]);
 writeln;
 close(input);
 close(output);
end.

信息

递交者
类型
递交
题目
Persistent Bits连续位
题目数据
下载
语言
Pascal
递交时间
2017-08-22 15:05:29
评测时间
2017-08-22 15:05:29
评测机
分数
80
总耗时
≥657ms
峰值内存
≥125.0 MiB