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

Обсуждение задачи 1393. Average Common Prefix

To admins: Time Limit in Java
Послано crdp 19 сен 2007 21:59
I wrote an O(n*log(n)) algorithm, but have got a TL.
I think this is a problem of Java language (there are arrays and garbage collector due to small memory limit).
And I saw that there is no AC on this problem using Java.
Can You change time-limit for Java on this task?
We have a java solution that works 2.0 sec (-)
Послано Vladimir Yakovlev (USU) 20 сен 2007 15:53


Edited by author 20.09.2007 15:54
Re: We have a java solution that works 2.0 sec (-)
Послано Denis Koshman 7 авг 2008 14:55
If it's N*log(N) due to sorting, you can implement it at O(N) via bucket sorting. Bucketing array can be filled at O(N) along with list of non-empty buckets. Later this list can be used for O(N) sorted array traversal and for fast cleanup before further sorts.