|
|
back to boardN log^2 N - TLE Hi, i coulnd't find anything better than N log^2 N solution for this taks, but it gives me TLE at 12 test case. Any hint for better approach? Re: N log^2 N - TLE Posted by forest 21 Apr 2007 17:57 all strings are up to 15 characters long, so i used preprocessing for each of the length Re: N log^2 N - TLE Mine is O( NlogN + MlogM + (N*15)logM ). It still got AC , and of course , not so fast ( ~ 2.8 s ). It can be faster but that's enough. I think you should optimize your code . Your complexity is fast enough. Re: N log^2 N - TLE Is it smart search on the tree or I can use binary search with some precalculations? Re: N log^2 N - TLE Can you explain in details the preprocessing of the strings ? Re: N log^2 N - TLE Posted by forest 21 Apr 2007 19:03 for each _len_ length of a string sort the original array using following ordering: 1. first _len_ chars of a string 2. number of times it is encountered, desc 2. whole string Re: N log^2 N - TLE I do the same but still have TLE on this server :( Although my computer process any test within 2.6 s Edited by author 22.04.2007 16:48 |
|
|