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 1102. Strange Dialog

An advice for crashers
Posted by Sergey Naumenko 16 Oct 2009 01:21
Using of dynamic memory allocation for the long string

char * s = new char [10000000];
//..
delete [] s;

allowed me to avoid the crash problem.
Suppose it would be helpful for someone.
Re: An advice for crashers
Posted by tiancaihb 16 Oct 2009 07:41
A better idea is to declear the array outside any functions.
#include ...
char s[1000000000000000000];
int main(){}
If you do so, it won't take up xxxxGB RAM. Instead, it depends on which part of the array you used.
For example, you only use 1-10000 of the array, it will use 10KB mem.
And that's cool.
Re: An advice for crashers
Posted by icanwin 16 Oct 2009 15:01
You are not right.
Re: An advice for crashers
Posted by tiancaihb 18 Oct 2009 15:52
why