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

Miguel Angel How to avoid Memory Limit Exced! [3] // Problem 1100. Final Standings 10 Dec 2001 06:56
Is there a way to avoid Memory Limit Exceded!?!? I use an array of
linked list and every node has a unsigned short and unsigned int,
inside a long, (24 bits < 32 bits), but still gets limit exceded
Here's the beginning of my program:

Program FinalStandings;
 Const Max=150000;
 Var a:Array[1..Max] Of Longint;
     b:Array[1..Max] Of Byte;
     i,j,n,mm:Longint;

var t:array[1..150000] of longint;
i,j,k,l,m,n,am,bm:longint;

function a(i:longint):longint;
begin
a:=t[i] shr 7;
end;

function b(i:longint):byte;
begin
b:=t[i] and 127;
end;

begin
readln(n);
for i:=1 to n do
begin
readln(am,bm);
t[i]:=am shl 7+bm;
end;
m:=b(1);
for i:=2 to n do
if b(i)>m then m:=b(i);
for i:=m downto 0 do
for j:=1 to n do
if b(j)=i then writeln(a(j),' ',b(j));
end.