ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1306. Sequence Median

why MLE at test 7? I use priority_queue and I stock only N/2 elements
Posted by Tusnad Nobrovirski 5 May 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
Posted by Korduban [Kiev] 6 May 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
Posted by Tusnad Nobrovirski 6 May 2007 13:04
ah, stupid me. thanks.
Re: why MLE at test 7? I use priority_queue and I stock only N/2 elements
Posted by AlMag 6 May 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
Posted by AlMag 6 May 2007 22:05
Oh, stupid me, too))
I did q.push_back(); That's why MLE.
Thanks, Korduban!