/ SB域 /

记录详情

Accepted

/usr/bin/ld.bfd: warning: /out/link.res contains output sections; did you forget -T?
# 状态 耗时 内存占用
#1 Accepted 1ms 256.0 KiB
#2 Accepted 1ms 256.0 KiB
#3 Accepted 0ms 256.0 KiB
#4 Accepted 1ms 256.0 KiB
#5 Accepted 1ms 256.0 KiB
#6 Accepted 1ms 256.0 KiB
#7 Accepted 1ms 256.0 KiB
#8 Accepted 1ms 256.0 KiB
#9 Accepted 1ms 256.0 KiB
#10 Accepted 1ms 256.0 KiB
#11 Accepted 1ms 256.0 KiB
#12 Accepted 1ms 256.0 KiB
#13 Accepted 1ms 256.0 KiB
#14 Accepted 1ms 256.0 KiB
#15 Accepted 1ms 256.0 KiB
#16 Accepted 1ms 256.0 KiB
#17 Accepted 1ms 256.0 KiB
#18 Accepted 1ms 256.0 KiB
#19 Accepted 1ms 256.0 KiB
#20 Accepted 1ms 256.0 KiB
#21 Accepted 0ms 256.0 KiB
#22 Accepted 0ms 256.0 KiB
#23 Accepted 0ms 256.0 KiB
#24 Accepted 1ms 256.0 KiB
#25 Accepted 1ms 256.0 KiB
#26 Accepted 1ms 256.0 KiB
#27 Accepted 1ms 256.0 KiB
#28 Accepted 1ms 256.0 KiB
#29 Accepted 1ms 256.0 KiB
#30 Accepted 1ms 256.0 KiB
#31 Accepted 1ms 256.0 KiB
#32 Accepted 1ms 256.0 KiB
#33 Accepted 1ms 256.0 KiB
#34 Accepted 1ms 256.0 KiB
#35 Accepted 1ms 256.0 KiB
#36 Accepted 1ms 256.0 KiB

代码

var n,i,num,p,ans:longint;
    a,b:array[1..100]of longint;
    s:array[1..100,1..100]of longint;
procedure qsort(l,r:longint);
var t,i,j,mid:longint;
begin
i:=l; j:=r;
mid:=a[(l+r)div 2];
while i<j do
begin
 while a[i]<mid do inc(i);
 while a[j]>mid do dec(j);
 if i<=j then begin
   t:=a[i]; a[i]:=a[j]; a[j]:=t;
   inc(i);dec(j);
 end;
end;
if l<j then qsort(l,j);
if r>i then qsort(i,r);
end;
function check(p,n:longint):boolean;
var i,j:longint;
    f:boolean;
begin
 for i:=p downto 1 do begin
  f:=true;
  for j:=1 to n do
   if s[i,j]<>a[j] then begin f:=false; break; end;
  if f then begin ans:=p-i; exit(true); end;
 end;
 exit(false);
end;
begin
 readln(n);
 for i:=1 to n do read(a[i]);
 p:=0;
 while true do begin
  inc(p);
  num:=0;
  for i:=1 to n do dec(a[i]);
  a[n+1]:=n;
  for i:=1 to n+1 do
   if a[i]>0 then begin inc(num); b[num]:=a[i]; end;
  n:=num;
  for i:=1 to n do a[i]:=b[i];
  qsort(1,n);
//  for i:=1 to n do write(a[i],' ');
//  writeln;
  if check(p,n) then begin
  writeln(ans);
  close(input);
  close(output);
  halt;
  end;
  for i:=1 to n do s[p,i]:=a[i];
 end;
end.

信息

递交者
类型
递交
题目
SolitaireSimulation 游戏
题目数据
下载
语言
Pascal
递交时间
2017-08-22 15:02:11
评测时间
2017-08-22 15:02:11
评测机
分数
100
总耗时
51ms
峰值内存
256.0 KiB