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 1220. Stacks

Why does my code fail?
Posted by ძამაანთ [Tbilisi SU] 22 Mar 2013 16:29
I create a struct STACK like this:
struct STACK
{
    int number;
    unsigned char before[3];
};

and keep arrays:
STACK LIST[100000+1];
int last[1000];

Apparently (3B+4B)*10^5 = 7*10^2 KB which is less than 750 :D
whats wrong with it? :/


how much memory does an empty cpp code consume?
Re: Why does my code fail?
Posted by ძამაანთ [Tbilisi SU] 23 Mar 2013 20:44
UPD:

now I use these arrays and structs:
struct STACK
{
    int number;
    unsigned short before;
};

int last[1000];
int counter = 0;
STACK *LIST = new STACK[100000+1];

int tmp = -1;
string strr("PUSH");

int additional_bit[3200];
char STR[5];

and still MLE XDXD


btw, an empty cpp code uses ~80KB which is OK for my code but why does it still fail?:/
Re: Why does my code fail?
Posted by Серовиков Андрей 29 Mar 2013 00:22
I think your struct is packed by compiler into nearest div 4 byte blocks, i.e. into 8byte blocks. Try to use arrays instead or search for additional compiler options