|
|
back to boardGreedy algorithm doesn't pass Test 3. Which algorithm to use ? Greedy algorithm doesn't pass Test 3. Which algorithm to use ? Please don't say just DP+tree. How do you buld a tree ? Building a tree is not problem, we can build the tree using STACK but it gives TLE on test 5. It takes too much time to build the whole tree. In this promlem, order of the words is important, so I have no idea how to use DP. Please, give some hints. Thanks, Re: Greedy algorithm doesn't pass Test 3. Which algorithm to use ? just DP Similar to Knapsack(I think) and need to store the previous element to recover the path in the end :) Re: Greedy algorithm doesn't pass Test 3. Which algorithm to use ? In Knapsack order is not important, but in this problem order is important. How do you deal with order ? Re: Greedy algorithm doesn't pass Test 3. Which algorithm to use ? Posted by Endoveg 30 Jul 2013 00:57 KNIGHT0X300 is right. It is an example of DP problem. Re: Greedy algorithm doesn't pass Test 3. Which algorithm to use ? I got AC using Trie Tree and Knapsack DP. Re: Greedy algorithm doesn't pass Test 3. Which algorithm to use ? use hash+dp |
|
|