Can anyone expline why my O(n log(n)) code takes 1620 ms to get the answer?

Правка en2, от DiaaEddin, 2017-07-17 21:47:04

I solved Mister B and PR Shifts using trie ... Time complexity of my code is O(n * log(n)) where maximum n = 1000000, but it takes about 1543 ms at least to get the answer, so can anyone please tell me why? 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://codeforces.me/contest/819/submission/28646689

Теги trie

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский DiaaEddin 2017-07-17 21:47:04 385
en1 Английский DiaaEddin 2017-07-17 16:29:25 663 Initial revision (published)