- 水王争霸
- 2016-07-23 16:44:32 @
测试数据 #0: Accepted, time = 0 ms, mem = 880 KiB, score = 5
测试数据 #1: WrongAnswer, time = 0 ms, mem = 880 KiB, score = 0
测试数据 #2: WrongAnswer, time = 0 ms, mem = 880 KiB, score = 0
测试数据 #3: WrongAnswer, time = 0 ms, mem = 884 KiB, score = 0
测试数据 #4: WrongAnswer, time = 0 ms, mem = 880 KiB, score = 0
WrongAnswer, time = 0 ms, mem = 884 KiB, score = 5
program losd;
var a,b:array[0..1002]of ansistring;
i,j,n,m,k,l:longint;
q:ansistring;
begin
readln(n);
for i:=1 to n do
begin
readln(b[i]);
readln(a[i]);
end;
for i:=1 to n-1 do
for j:=i to n do
if length(a[i])<length(a[j]) then
begin
q:=a[i];a[i]:=a[j];a[j]:=q;
q:=b[i];b[i]:=b[j];b[j]:=q;
end;
for i:=1 to n-1 do
if length(a[i])=length(a[i+1]) then
if (a[i]<a[i+1])or((a[i]=a[i+1])and(b[i]>b[i+1]))
then
begin
q:=a[i];a[i]:=a[i+1];a[i+1]:=q;
q:=b[i];b[i]:=b[i+1];b[i+1]:=q;
end;
for i:=1 to n do
writeln(b[i]);
end.