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 1613. For Fans of Statistics

WA#4... WHY? My algo is here...
Posted by Li Wang Ji 26 May 2008 02:53
I wrote simple Binary search but got WA#4... Where is my mistake? Maybe there are some special cases... Can you help me, please? Thanks in advance...
Re: WA#4... WHY? My algo is here...
Posted by SPb SU 14 30 May 2008 17:37
I had wa4 and this test helped me to get AC:
6
1 0 1 0 0 1
6
2 2 1
1 1 1
3 3 1
4 4 1
6 6 1
4 5 1
// correct answer is 011010
Re: WA#4... WHY? My algo is here...
Posted by Howard Liu 31 May 2008 02:26
Try using the STL lower_bound for binary search. It really cuts down potential errors on edge cases.