Comments

does this famous result have a name if I want to learn more about it and those like it?

I assume that means you passed? In which case congrats, mine didn't :^(. Clearly some edge case I'm not thinking of, shouldn't have been lazy. Please share your submission, if so.

don't the 6 cases degenerate into:

l = max(l — k, l2) and r = min(r + k, r2)

where [r, l] are the current valid range and [r2, l2] are the one we're checking to see if this k is valid.

you're re-intitialising your 'facts' array for every test case. it would be the same every time.

aw nuts, messed up with the loop condition. Accepted now :). Thanks so much!

Hello I have followed the same idea, removing leftmost s[i] when s[i] > s[i+1]. It runs in O(n) time. The no-spaces-bw-testcases rule makes it impossible to find where I'm going wrong. Please help me if you can.

My Code

if x=6, and a=2 and b=10, a^b=8. now if increase a by 1, a=3, b=9. and a^b=10. so on increasing a => a^b increases. now we increase a by 2. 5^7= 2. therefore a^b is not monotonic so not a candidate for binary search

for binary search doesn't f(x) have to be monotonic? sorry I'm not understanding how bs won't get stuck somewhere. In this case

$$$\frac{X}{2}$$$

is a solution for a so bs will always try it but how do you prove it without knowing the solution beforehand?

you've probably figured but () is a good substring and it is shorter than ())(

unrepeated balls, it's in the editorial

In D, if x represents 2 balls shouldn't we seek to minimise 2x+y? I am not getting the part with the inequalities:(

ah! sorry, yes D.

In D, if x represents 2 balls shouldn't we seek to minimise 2x+y? I am not getting the part with the inequalities:(

what's a residue

got A wrong thrice because i was using std::unique wrong lol :'). cost me 300 pts and couldn't finish B. sigh.

your graph gives me hope

we want distinct letters i.e., the frequency should only be 0 or 1.

0

GOD i was so close to getting D >:(

did you?

any idea why this is correct? i used the same but am not able to prove it is always correct like they did in the editorial.

any idea why this is correct? i used the same but am not able to prove it is always correct like they did in the editorial.

still unclear why for problem D, why we used T(n) = 2T(n/3) + O(1) , but it's really T(n/3)+T((2*n)/3)+O(1). you could say the 2/3 will dominate so b should be 1.5 but then time complexity is n^(log1.5(1)) which is O(n).