Clark_Kent's blog

By Clark_Kent, history, 7 weeks ago, In English

In this problem, 757D - Felicity's Big Secret Revealed the space complexity N*(2^20) causes MLE in JAVA whereas gets accepted in C++. The DP array uses space N*(2^20) in my submission.

Can somebody help me understand why this is happening? Is it a java thing?

 
 
 
 
  • Vote: I like it
  • -2
  • Vote: I do not like it

»
7 weeks ago, # |
  Vote: I like it +4 Vote: I do not like it

Don't use java lol

»
7 weeks ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Where is the C++ accepted solution with the same approach? https://codeforces.com/contest/757/submission/124896403 try to understand why

»
7 weeks ago, # |
  Vote: I like it +10 Vote: I do not like it

You are allocating a $$$N \, 2^{20}$$$ sized array of 64 bit integers (8 bytes). $$$N$$$ can go up to 75. This means you are allocating $$$8 \cdot 75 \cdot 2^{20} \, \text{bytes} = 600 \, \text{MiB}$$$. The memory limit for that problem is $$$512 \, \text{MiB}$$$.