Please read the new rule regarding the restriction on the use of AI tools. ×

Help needed in the problem 895C Square Subsets

Revision en2, by ankitdipto, 2020-09-23 10:24:31

I am unable to understand why declaring an array dp[71][1<<20] results in MEMORY LIMIT EXCEEDED in the code. As far as the problem definition is concerned I only need 19 bits (there are 19 prime numbers less than 70) hence the problem can be solved by using array of size dp[71][1<<19]. Using the latter I have indeed got AC but I don't know why my code is taking too much memory in general.

Link to the problem

Here goes my code: 93536513

Since I am posting for the first time I beg pardon for the ill formatting!

Tags #dp, #maths, #combinatorics, #bitmasks

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English ankitdipto 2020-09-23 10:27:36 0 Removed the pasted code (published)
en2 English ankitdipto 2020-09-23 10:24:31 3140 (saved to drafts)
en1 English ankitdipto 2020-09-23 10:18:12 3774 Initial revision (published)