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

Обсуждение задачи 1306. Медиана последовательности

why MLE at test 7? I use priority_queue and I stock only N/2 elements
Послано Tusnad Nobrovirski 5 май 2007 22:26
[code was here]

Edited by author 06.05.2007 14:46
Re: why MLE at test 7? I use priority_queue and I stock only N/2 elements
Послано Korduban [Kiev] 6 май 2007 12:09
Because priority_queue is based on vector, so it can allocate memory for 2*H.size() cells before push. Try to use vector with fixed size + algorithms (push_heap, pop_heap).
Re: why MLE at test 7? I use priority_queue and I stock only N/2 elements
Послано Tusnad Nobrovirski 6 май 2007 13:04
ah, stupid me. thanks.
Re: why MLE at test 7? I use priority_queue and I stock only N/2 elements
Послано AlMag 6 май 2007 21:48
How to make vector with fixed size?
"vector < unsigned int > v(125001)" doesn't work.
And "v.resize(125001)" too.
Re: why MLE at test 7? I use priority_queue and I stock only N/2 elements
Послано AlMag 6 май 2007 22:05
Oh, stupid me, too))
I did q.push_back(); That's why MLE.
Thanks, Korduban!