ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1821. Biathlon

Why wa1?
Posted by Geeks_Club 19 Mar 2011 14:47
My answer to the example is as follows:
3
Hauswald
Wilhelm
Zaitseva

Check my solution please !
Re: Why wa1?
Posted by Nathalie 19 Mar 2011 14:50
Maybe you have extra spaces in the end of each line?
Re: Why wa1?
Posted by SmartCoder 19 Mar 2011 14:54
the same i think my solution is true and no extra spaces
Re: Why wa1?
Posted by Geeks_Club 19 Mar 2011 18:17
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?
Posted by Nikita++ 19 Mar 2011 18:42
Don't you think that your code is too long and it is difficult to understand?
Re: Why wa1?
Posted by psych069 4 Apr 2011 22:45
For sure u guys r not the only ones with that problem >.<

After i sent my solution i took WA at #1,
then i posted :
#include <iostream>
using namespace std;
int main()
{
cout << "3\nHauswald\nWilhelm\nZaitseva" ;
return 0;
}
and i took WA at #2;

Compiled both sources on my machine and the console output was exactly one and the same Q.Q
Give us a clue please!
Regards, B.P. !
Re: Why wa1?
Posted by zaycakitayca 5 May 2012 17:24
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