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

How to avoid Memory Limit Exced!
Posted by Miguel Angel 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
This problem seems to be so simple! I can't understand why did so many people get "Memory Limit Exceeded". Read the message
Posted by shitty.Mishka 10 Dec 2001 21:58
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;

my program got ac whith spliting longint in 24 and 8 bits
Posted by Dinu Adrian Florin 29 Apr 2004 17:40
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.
After system upgrade this code takes MLE on test 11!!!
Posted by Vlad Veselov 29 Apr 2004 18:13