ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1635. Mnemonics and Palindromes

I finally did it
Posted by Servy 12 Oct 2008 05:21
Got AC. There were "Time Limit Exceeded" at tests 32, 56, 59, 60 before i made some complicated enhancements to my program. The monitor have shown smth around 0,9 second for some tests, so it was pretty close.

My algo uses O(N*N) memory and O(N*Ln(N)) or O(N*N) operations (depends on input string; there are too slightly different ways of algorithm). I suppose there should be better solution. Any hints about that?

Edited by author 12.10.2008 05:22
Re: I finally did it
Posted by huangwei 12 Oct 2008 09:23
how did you do in O(N*Ln(N)) or O(N*N) operations ?
I got AC, but my solution use 0.5+s, it's too slowly.
I use O(N*N) find all Palindromes, and use greedy, memorize search
Re: I finally did it
Posted by huangwei 12 Oct 2008 09:51
oh, O(N*N) dynamic programing will get 0.1s
Re: I finally did it
Posted by Anisimov Dmitry (Novosibirsk STU) 12 Oct 2008 20:20
Cool. At first, I wrote O(N^3). It was too slow. I wrote hash cutoff it so it was close to O(N^2), though, worst-case still O(N^3), got AC. Today I realize there is O(N^2) solution and read mention of O(N*log(N)).

Is O(N*log(N)) bestcase? Is worstcase still O(N^2)?

Edited by author 12.10.2008 20:22