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

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

Does anybody know better algorithm???
Послано Fokysnik 31 июл 2006 14:52
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???
Послано SPIRiT 1 авг 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???
Послано Tkach 2 авг 2006 01:08
Build graph and use BFS...
It works fast just see http://acm.timus.ru/status.aspx?space=1&num=1002&author=35175

Edited by author 02.08.2006 01:10
Re: Does anybody know better algorithm???
Послано SPIRiT 2 авг 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???
Послано Tkach 2 авг 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???
Послано wangyin 11 авг 2006 14:28
I use dynamic programming.
Time is 0.125s
But memory...12***k
Re: Does anybody know better algorithm???
Послано ITStepDnepr 11 дек 2006 21:05
i cant understand - what kind of graph?
Does anybody know better algorithm???
Послано Oybek 4 окт 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???
Послано Rootis 13 окт 2007 00:33
what graph you build?