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

Andrew Hoffmann aka SKYDOS [Vladimir SU] How to solve this problem using <1MB memory? [2] // Problem 1287. Mars Canals 19 Aug 2010 15:32
I used only ~2MB in C#, but want to know how to improve it.
Thx.
Vedernikoff Sergey (HSE: АОП) Re: How to solve this problem using <1MB memory? [1] // Problem 1287. Mars Canals 19 Aug 2010 21:15
The problem can be solved in O(N) memory. Just read line-by-line and calculate something =)
Andrew Hoffmann aka SKYDOS [Vladimir SU] Re: How to solve this problem using <1MB memory? // Problem 1287. Mars Canals 19 Aug 2010 21:18
I did a little bit different: I saved NxN matrix using BitArray and after that used 2xN array to culc answers, but I see that its even possible to solve this problem without saving all matrix at all, just 2xN array.