I solved [Mister B and PR Shifts](http://mirror.codeforces.com/contest/819/problem/B) using trie ... ↵
Time complexity of my code is O(n * log(n)) where maximum n = 1000000 ..., but it takes about 1620543 ms at least to get the answer, so can anyone please tell me why?↵
this is my first submission:↵
[http://mirror.codeforces.com/contest/819/submission/28102807](http://mirror.codeforces.com/contest/819/submission/28102807)↵
and this is the best code I came up with:Update..↵
some users advised me to use array instead of pointers with dynamic memory allocation and thats what I did ↵
this is the best code I came up with so far .. no dynamic memory allocating . no pointers ↵
but my code still too slow and I don't know why ↵
[http://mirror.codeforces.com/contest/819/submission/28110510646689](http://mirror.codeforces.com/contest/819/submission/28110510)↵
sorry for my bad English.↵
thanks.646689)
Time complexity of my code is O(n * log(n)) where maximum n = 1000000
[http://mirror.codeforces.com/contest/819/submission/28102807](http://mirror.codeforces.com/contest/819/submission/28102807)↵
and this is the best code I came up with:
some users advised me to use array instead of pointers with dynamic memory allocation and thats what I did ↵
this is the best code I came up with so far .. no dynamic memory allocating . no pointers ↵
but my code still too slow and I don't know why ↵
[http://mirror.codeforces.com/contest/819/submission/28
sorry for my bad English.↵
thanks.