|
|
back to boardHow to avoid Memory Limit Exced! 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 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 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!!! |
|
|