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

Accepted WA #5 [3] // Problem 1306. Sequence Median 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 [2] // Problem 1306. Sequence Median 12 Jun 2014 23:40
You need use unsigned int.
EGlym Re: WA #5 [1] // Problem 1306. Sequence Median 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
ToadMonster Re: WA #5 // Problem 1306. Sequence Median 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.