Re: Why wa1?
why is wa 1? here the code of the my solution pleas chek:
uses
SysUtils,math;
Type m = record
name:string[21];
min:integer;
seconds:real;
pos:integer;
end;
Var n,i,c:integer;
tmp:string;
mas:array[1..101]of m;
tmpG1:m;
j,Size,k:integer;
TopName:array[1..101] of m;
t:m;
function CompareStr1(const S1, S2: string): Integer; assembler;
asm
PUSH ESI
PUSH EDI
MOV ESI,EAX
MOV EDI,EDX
OR EAX,EAX
JE @@1
MOV EAX,[EAX-4]
@@1: OR EDX,EDX
JE @@2
MOV EDX,[EDX-4]
@@2: MOV ECX,EAX
CMP ECX,EDX
JBE @@3
MOV ECX,EDX
@@3: CMP ECX,ECX
REPE CMPSB
JE @@4
MOVZX EAX,BYTE PTR [ESI-1]
MOVZX EDX,BYTE PTR [EDI-1]
@@4: SUB EAX,EDX
POP EDI
POP ESI
end;
function timeCompare(m1:integer;S1:real;d1:integer; m2:integer; s2:real; d2:integer):boolean;
Var ch:boolean;
begin
if (m1+(floor(d1+s1) div 60))>(m2+(floor(d2+s1) div 60)) then
begin
ch:=true;
end
else if(m1+(floor(d1+s1) div 60))=(m2+(floor(d2+s1) div 60))
then
begin
if (s1+d1-(floor(s1+d1) div 60)*60)>(s2+d2-(floor(s2+d2) div 60)*60) then ch:=true
else ch:=false;
end
else ch:=false;
result:=ch;
end;
begin
readln(n);
for i:=1 to n do
begin
readln(tmp);
mas[i].name:=Copy(tmp,1,pos(' ',tmp)-1);
Delete(tmp,1,pos(' ',tmp));
Val(copy(tmp,1,pos(':',tmp)),mas[i].min,c);
Delete(tmp,1,pos(':',tmp));
Val(tmp,mas[i].seconds,c);
mas[i].pos:=i-1;
end;
tmpG1:=mas[1];
TopName[1]:=Mas[1];
j:=1;
for i:=2 to n do
if timeCompare(TmpG1.min,TmpG1.seconds,TmpG1.pos*30, Mas[i].min,Mas[i].seconds,Mas[i].pos*30){Min>mas[i]} then
begin
for k:=j downto 1 do
if timeCompare(TopName[k].min,TopName[k].seconds,TopName[k].pos*30,Mas[i].min,Mas[i].seconds,Mas[i].pos*30) then dec(j);
inc(j);
TopName[j]:=Mas[i];
end
else
if timeCompare(TmpG1.min,TmpG1.seconds,0,Mas[i].min,Mas[i].seconds,0) then
begin
inc(j);
TopName[j]:=Mas[i];
tmpG1:=mas[i];
end;
Size:=j;
for i:=1 to Size do
for j:=1 to Size do
begin
if CompareStr1(TopName[i].name,TopName[j].name)<0 then
begin
t:=TopName[i];
TopName[i]:=TopName[j];
TopName[j]:=t;
end;
end;
writeln(size);
for i:=1 to size do
writeln(Topname[i].name);
end.
Re: Why wa1?
I don't understand well why it works, but when i've changed variable type for sportsmens counting from unsigned char to unsigned short, i've passed this test (despite of maximal count is 100, and correct input/output in my program). I think that if u have any troubles with it, u should try some different variable types and output commands