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

Обсуждение задачи 1065. Граница

efficient idea
Послано Cuac!++ 7 апр 2008 07:07
Hi!, i have gotten AC in this problem, but i have 0.093 secs, and im not well ranked on the best solutions table, i think the difficult part of this problem is to see which triangle have historical monuments inside, i did it with an O ( logM * M * N ) approach, do anybody have something better? i really would like to know how to get 0.015 secs or less. Thank you very much! Eric ( Cuac!++ ).
Re: efficient idea
Послано hedrok 9 апр 2008 00:09
Hi. I've got 0.015 secs. http://acm.timus.ru/status.aspx?author=34678&num=1065&refresh=no
My algo woks O(M*N + N^3).
Here is my idea:
i don't look which triangles contain historical monuments. i calculate which sequences of vertexes can we delete and what length we win if we do so. Then i find optimal way of selecting these sequences of vertexes.
Do you need more details?
Re: efficient idea
Послано ASK 24 апр 2018 00:12
Nope, it is at least O(M*N*log(N) + N^3), but with N~50 it is not noticeable.

For each tower check how many towers can be skipped, that is for each possible skipping length check if there are monuments ccw to the chord: O(M*N^2), but can be O(M*N*log(N)) with binary search.

For each length and each start calculate minimal perimeter on the way from start to start+length trying all intermediary towers: O(N^3).

For each triple of towers that form a triangle, sum minimal perimeters and find the global minimum: O(N^3).