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

WA #5
Posted by Accepted 2 Mar 2013 12:05
I use priority queue,the memory that I used is 236 KB,but I still WA at test 5,but I don't know why...
Re: WA #5
Posted by Міша 12 Jun 2014 23:40
You need use unsigned int.
Re: WA #5
Posted by EGlym 18 Feb 2017 05:39
could someone tell me why ?

Edited by author 18.02.2017 05:40

Edited by author 18.02.2017 05:40
Re: WA #5
Posted by ToadMonster 18 Feb 2017 20:26
2^31-1 can be stored into signed int.

But, when length of input is even, you need to value average, so (probably) add 2 values and receive integer overflow.
It doesn't mean you must use unsigned. You can avoid overflow in any other way.