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 1998. The old Padawan

WA #6
Posted by Harry 5 Oct 2014 01:09
Please! Give me some tests.
Re: WA #6
Posted by 84970000 9 Oct 2014 14:10
Me too!Have you solved this problem?
Re: WA #6
Posted by Ueli Peter 28 Oct 2014 08:46
same here :(
Re: WA #6
Posted by SButterfly [Samara SAU] 7 Nov 2014 23:03
I have this WA too.
Firstly, I used binary search to find the last element, which didn't fall.

And my mistake was:
if (currentSum == k)
 return med;

the corrent ones:
if (currentSum == k)
 return med-1;

And for case, where we haven't found exactly k sum:

..
}//end of binary search

int answerIndex = l;
int sum = getSum(left, lastAdded Index);
if (sum <= k){
    answerIndex = l - 1;
}
return answerIndex;


But now I have TL11
Re: WA #6
Posted by Oxxxymiron 28 Nov 2014 18:17
5 1 4
1 2 3 4 5
5
ans: 8
Re: WA #6
Posted by Sq1 26 Jan 2017 21:20
ty