|
|
вернуться в форумTime limet 12th test Послано Demjan 23 апр 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. |
|
|