ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1002. Телефонные номера

Greedy algorithm doesn't pass Test 3. Which algorithm to use ?
Послано Hikmat Ahmedov 22 авг 2012 22:02
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 ?
Послано KNIGHT0X300 26 авг 2012 22:47
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 ?
Послано Hikmat Ahmedov 31 авг 2012 10:46
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 ?
Послано Endoveg 30 июл 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 ?
Послано Mohammad Samiul Islam 19 мар 2014 20:11
I got AC using Trie Tree and Knapsack DP.
Re: Greedy algorithm doesn't pass Test 3. Which algorithm to use ?
Послано dangminhhieu78 2 янв 2015 08:37
use hash+dp