Comments

$$$ 111000111000111000_2 $$$ can be divided and conquered as sum of answers of $$$ 111000_2 $$$, $$$ 111000000000_2 $$$ and $$$ 111000000000000000_2 $$$. Infact it will also be equivalent to

$$$ ans(111000_2) + ans(111000_2) + ans(111000_2) = 3 * ans(111_2) $$$

We just need to process the segments where we get 1s.
ans(1) = 1 ans(11) = 2 ans(111) = 2 ans(1111) = 2 and so on

https://codeforces.me/blog/entry/95133?#comment-841488

I still dont know if I am missing something here.

Sorry, I missed this case. I think we can always create consecutive 1's by subtracting

$$$ 0 - 1 = 10 $$$

(by taking a carry) in binary form, provided there is a 1 in the left.
That is we can always replace continuous 1s with 2 operations, putting a 1 in the left and subtracting it by 1. Example: We want 1110

$$$ 10000 - 10 = 1110 $$$

So either it is 2 operations or (no of 1 bits) = x operations. We have to take minimum of it and sum all of such operations on consecutive 1s in the binary representation of n to get the answer.

As any n can be represented in binary form which is nothing but sum of powers of 2. So the answer will be number of 1s in binary notation of n. Example: $$$10 = (1010)_2$$$ Here count of 1s = 2 = answer

On sru_31DESHAW Online Coding Test, 5 years ago
+2

For the first problem, I had an approach but idk about its correctness.

Test Case:
v = {"ab","abdf","abe"}

Approach:
1. Take the first string as winner = "ab".
2. Compare current winner with second string according to the rules, "abdf" > "ab", so winner = "abdf".
3. Repeat step 2 for each string.

Consider this case :

1
6 2 2
2 2 2 2 2 2

Thanks a lot. Great work!

Please predict mine too.

Solved D with DP and used only two states — [index][x]. I thought that x and prev are inter-related. I also tried [index][prev] but it was wrong. Is it wrong and just a coincidence with test cases? https://codeforces.me/contest/1455/submission/100080134

How is the space complexity for div2B O(N) ?

This is a nice idea. Atleast people who create new account to avoid rating change (which is one of the main reasons for alt accounts), will be enjoying the contests from their existing account.

Practice. Why not hear from here and Here

Maybe, but there are lots of other things like previous experience with Maths, solving Quality questions, etc. So in general, judging just on the basis of number of questions solved is not fair. Here Quality depends on person to person.

Please add LeetCode if thats possible.

0

Its actually Arithmetic Mean >= Geometric Mean i.e. p1 + p2 + p3 + .... + pn >= n x nth root of (p1 x p2 x p3 ... x pn). If we make all of them equal to p, only then LHS = RHS otherwise LHS > RHS.

Questions were great in the contest. Took me 1.5 hrs for first AC. I enjoyed it a lot. Thanks to problem setters and editorialists :)

On MinakoKojimaCodeforces Round #183, 6 years ago
0

When n is even, S = n * (n — 1) / 2 let n / 2 = p which is smaller than n S = p * (n — 1) Clearly, S in this case is not divisible by n.

Removing a '+' sign from there worked for me. Although it has turned into a better practice zone as all the links of the side bar are gone now LOL. Thanks namig17333

Is it only for russian version? I am unable to see any effect on english version except a new problem tag in russian.

0

I liked this round. It was more of speed. Thanks MikeMirzayanov.

0

I am unable to get how (distance + moves)/2 = no of +. Any Help?