[Help] How to optimize memory of Trie in 1625D — Binary Spiders

Revision en1, by simp_pro, 2023-12-08 21:20:47

Problem link: https://mirror.codeforces.com/contest/1625/problem/D

Sorry for necroposting, but I didn't find any solution for this in comments or anywhere

In problem D, The editorial solution uses a trie. if you use trie. Then there are at most nlogA vertices. If we implement using pointers then its memory would be nlogA*32 (32 if because of pointer address size in 32 bit compiler) = 3*10^5*30*30 = 2.7*10^8 ~ 2 GB. But memory limit is just 256 MB. How to solve this issue?

My MLE submission

Tags trie

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English simp_pro 2023-12-08 21:20:47 619 Initial revision (published)