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 1287. Mars Canals

Java vs MLE
Posted by unlucky [Vologda SPU] 21 Feb 2010 05:01
If you use Java pay attention to size of arrays, that you used.
I used 2 arrays for saving current line and prev line of input(every has o(n) elements), and 2 arrays for saving result of calculating in prev Line, and for saving result of calculation in current line (every has o(n) elements).

Edited by author 21.02.2010 15:56
Re: Java vs MLE
Posted by Fyodor Menshikov 3 Mar 2010 19:19
This problem is not so memory consuming. Java solution using variable
char field[][] = new char[1 + n + 1][1 + n + 1];
gets AC.

So it is possible to store whole input in memory, but it is impossible to store significant amount of data for each cell. For example 4 arrays NxN of 16-bit ints need extra 16 Mb of memory while total ML is 16 Mb.