Help->O(NlogN) giving TLE(4 s) in TRIE problem.

Revision en3, by Codeforcer, 2021-06-01 17:42:03

I was attempting this problem :

https://codeforces.com/contest/706/problem/D

I tried using trie and it gives TLE. I saw solutions of other people but most of them have created a TRIE by using struct and pointers. I have done it using a 2d next array following the idea from Errichto topic video of trie. I cant figure out why there is TLE, maybe because of map ? Any help would be appreciated.

Here is my code :

D

UPD Got accepted!

Thanks!

Tags trie, tle, help

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English Codeforcer 2021-06-01 17:42:03 27 Tiny change: 'oiler>\n\nThanks' -> 'oiler>\n\n**UPD** Got accepted! \n\nThanks'
en2 English Codeforcer 2021-06-01 16:35:10 1623 Tiny change: 'n\n~~~~~\n//Think simple yet elegant.\n#include' -> 'n\n~~~~~\n#include'
en1 English Codeforcer 2021-06-01 16:33:34 476 Initial revision (published)