/ SB域 /

记录详情

Accepted

/usr/bin/ld.bfd: warning: /out/link.res contains output sections; did you forget -T?
# 状态 耗时 内存占用
#1 Accepted 2ms 256.0 KiB
#2 Accepted 2ms 256.0 KiB
#3 Accepted 2ms 256.0 KiB
#4 Accepted 3ms 324.0 KiB
#5 Accepted 5ms 384.0 KiB
#6 Accepted 7ms 488.0 KiB
#7 Accepted 35ms 712.0 KiB
#8 Accepted 139ms 1.094 MiB
#9 Accepted 137ms 1004.0 KiB
#10 Accepted 111ms 992.0 KiB

代码

var n,i,j:longint;
    a:array[1..100000]of ansistring;
  //  aa,bb:ansistring;
procedure swap(var a,b:ansistring);
var t:string;
begin
t:=a; a:=b; b:=t;
end;
procedure qsort(l,r:longint);
var i,j:longint;
    mid:ansistring;
begin
 i:=l; j:=r; mid:=a[(l+r) div 2];
 repeat
  while a[i]>mid do inc(i);
  while a[j]<mid do dec(j);
  if i<=j then begin
   swap(a[i],a[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(n);
 for i:=1 to n+1 do a[i]:=chr(1);
 for i:=1 to n do readln(a[i]);
 qsort(1,n);
 {for i:=1 to n do begin
  if a[i]+a[i+1]<a[i+1]+a[i] then swap(a[i],a[i+1]);
 end;}
 for i:=1 to n-1 do
  for j:=i+1 to n do
   if (a[i]+a[j])<(a[j]+a[i]) then swap(a[i],a[j]);
  for i:=1 to n do write(a[i]);
  writeln;
close(input);
close(output);
end.

信息

递交者
类型
递交
题目
数字积木
题目数据
下载
语言
Pascal
递交时间
2017-08-22 15:15:38
评测时间
2017-08-22 15:15:38
评测机
分数
100
总耗时
449ms
峰值内存
1.094 MiB