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

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

Показать все сообщения Спрятать все сообщения

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,
just DP Similar to Knapsack(I think) and need to store the previous element to recover the path in the end :)
In Knapsack order is not important, but in this problem order is important.
How do you deal with order ?
KNIGHT0X300 is right. It is an example of DP problem.
I got AC using Trie Tree and Knapsack DP.
use hash+dp