/ 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 2ms 188.0 KiB
#4 Accepted 0ms 256.0 KiB
#5 Accepted 2ms 256.0 KiB
#6 Accepted 4ms 256.0 KiB
#7 Accepted 3ms 256.0 KiB
#8 Accepted 11ms 256.0 KiB
#9 Accepted 14ms 328.0 KiB
#10 Accepted 12ms 340.0 KiB

代码

var n,i,tt,time,ans:longint;
    a:array[0..100000]of longint;
   // u:array[1..100000]of boolean;
procedure swap(var a,b:longint);
var t:longint;
begin
t:=a; a:=b; b:=t;
end;
procedure qsort(l,r:longint);
var i,j,mid:longint;
begin
 i:=l; j:=r; mid:=abs(a[(l+r) div 2]);
 repeat
  while abs(a[i])<mid do inc(i);
  while abs(a[j])>mid do dec(j);
  if i<=j then begin
   swap(a[i],a[j]);
  // swap(u[i],u[j]);
   inc(i);
   dec(j);
  end;
 until i>j;
 if i<r then qsort(i,r);
 if j>l then qsort(l,j);
end;
begin
 readln(time,n);
 //fillchar(u,sizeof(u),true);
 for i:=1 to n do readln(a[i]);
 qsort(1,n);
 //for i:=1 to n do write(a[i],' ');
 i:=0;
 while time>=0 do begin
  time:=time-abs(a[i]-a[i+1]);
  inc(i);
 end;
 writeln(i-1) ;
 close(input);
 close(output);
end.

信息

递交者
类型
递交
题目
二中漫步
题目数据
下载
语言
Pascal
递交时间
2017-08-22 15:18:05
评测时间
2017-08-22 15:20:33
评测机
分数
100
总耗时
55ms
峰值内存
340.0 KiB