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

Обсуждение задачи 1273. Шпалы

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

And what about this test? Sandro 31 янв 2005 15:42
My AC solution with DP outputs 2 in this test:
6
0 3
1 0
2 2
3 5
4 1
5 4

But the correct answer is 3. Maybe this test should be added to the test set.
My output is 3, so your DP is rather strange :) (-) Dmitry 'Diman_YES' Kovalioff 31 янв 2005 15:53
I think so :)
How did you solve it? Vladimir Yakovlev (USU) 1 фев 2005 20:09
Re: How did you solve it? Sandro 3 фев 2005 11:27
I remember the optimal answer for sets of ties with numbers k..l for all k,l (for all segments).

The optimal answer Ans(k,l+1)= max(Ans(k,l),S+1), where S is the sum of optimal answers for all segments in k..l, that any tie of any of these segments doesn't intersect (l+1)th tie. (In the first case we delete (l+1)th tie, in the second case leave (l+1) and delete all ties, intersecting it.)
    This algorith is not correct, because ties in the optimal solutions can intersect, so sum of the optimal solutions may not be solution at all. My test is the simple example of it. But this algorith gets AC, and this is very strange.