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 1048. Superlong Sums

Help me - I get memory limit exceeded!!!!
Posted by Michael Medvedev (KNU training center) 5 Jan 2002 20:53
I use res:array[0..250001] of integer keeping four digits in each
element of array (in one integer I keep numbers from 0 to 9999 - four
digits). In total I use 250002 * 2 = 500004 bytes (500004 / 1024 =
489K) - it's less then 1000K, but in online status I see that my
program uses 1052K. What's the matter?

Here is my all part of variable definition:

const mx = 250001;
var am,temp,cur,i,j,n:longint;
    res:array[0..mx] of integer;
    carry,k,l,a,b:word;

Ok, tell me, please to medv@roller.ukma.kiev.ua how to solve this
problem without arrays.
Re: Help me - I get memory limit exceeded!!!!
Posted by I have answers to all your questions :) 5 Jan 2002 22:31
because Pascal compiler here is Delphi, sizeof(Integer) = 4
Re: You must use "Smallint" instead of "Integer" !!!
Posted by Happy New Year! Russia. 6 Jan 2002 00:51
> I use res:array[0..250001] of integer keeping four digits in each
> element of array (in one integer I keep numbers from 0 to 9999 -
four
> digits). In total I use 250002 * 2 = 500004 bytes (500004 / 1024 =
> 489K) - it's less then 1000K, but in online status I see that my
> program uses 1052K. What's the matter?
>
> Here is my all part of variable definition:
>
> const mx = 250001;
> var am,temp,cur,i,j,n:longint;
>     res:array[0..mx] of integer;
>     carry,k,l,a,b:word;
>
> Ok, tell me, please to medv@roller.ukma.kiev.ua how to solve this
> problem without arrays.
>
>
Read this
Posted by Aidar 10 Feb 2002 21:07
Usually i write:
type
  integer = -32767..32768;

Good luck!