|
|
back to boardDoes anybody know better algorithm??? I've written my program using recursion, and it gets Time Limit Exceded on test #5 :( Any ideas wold be great. Re: Does anybody know better algorithm??? Posted by SPIRiT 1 Aug 2006 14:01 I use KMP for substring search. And also instead of recursion for finding the shortest combination I use DP. And I get not TLE but WA:(. Must be some technical reasons. But the idea itself is great. Re: Does anybody know better algorithm??? Posted by Tkach 2 Aug 2006 01:08 Re: Does anybody know better algorithm??? Posted by SPIRiT 2 Aug 2006 19:23 And my solution worked too. DP is also suitable for the solution. What I didn't expected is that there is not always (-1) in the end of the input(!!!) Re: Does anybody know better algorithm??? Posted by Tkach 2 Aug 2006 20:27 No.. I think all right... My algo: Cin >> S; While (S!="-1") { Read_Words(); Build_Graph(); BFS(); Write_Ans(); Cin >> S; } Re: Does anybody know better algorithm??? Posted by wangyin 11 Aug 2006 14:28 I use dynamic programming. Time is 0.125s But memory...12***k Re: Does anybody know better algorithm??? i cant understand - what kind of graph? Does anybody know better algorithm??? Posted by Oybek 4 Oct 2007 17:39 Edited by author 04.10.2007 17:42 sdfgdf Edited by author 04.10.2007 17:42 Edited by author 04.10.2007 17:43 Re: Does anybody know better algorithm??? Posted by Rootis 13 Oct 2007 00:33 what graph you build? |
|
|