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 1100. Final Standings

Time limet 12th test
Posted by Demjan 23 Apr 2008 04:15
My time on 12th test is 1.031s so my test must be faster for 0.031s :).Can someone tell me what can I do with my code to work faster?

Code:
program sort;
type
  team = record
    id: longint;
    m: byte;
  end;
var
  i,n,j: longint;
  a: array[0..150000] of team;
  tmp: team;
begin
  readln(n);
  readln(a[1].id,a[1].m);
  for i := 2 to n do
  begin
    readln(a[i].id,a[i].m);
    j := i;
    if a[j].m > a[j-1].m then
    while (a[j].m > a[j-1].m) and (j > 1) do
    begin
      tmp := a[j];
      a[j] := a[j-1];
      a[j-1] := tmp;
      dec(j);
    end;
  end;
for i := 1 to n do
  writeln(a[i].id,' ',a[i].m);
end.