Codeforces Round 1107 (Div. 3) Participation Report

It’s me.

I participated in Codeforces Round 1107 (Div. 3). I solved 4 problems. It feels like I might be able to reach green rank in about two more rounds. Maybe if I can pull off a quick 2-solve in Div. 2, I could even hit green in the next one?

I coded problems A through C on my PC, and from the middle of D, I was coding on my smartphone in bed.


Problem A Divide and Conquer

It’s written in a somewhat complicated way, but basically, it’s just x % y == 0 ? "Yes" : "No". That’s all.


Problem B Good times Good times

I don’t know how you’re supposed to think about this if you tackle it too seriously, but if you concatenate the same string to the end, a good number remains a good number, right? This means if the number of digits in xx is aa, then y=10a+1y = 10^a + 1. Is the fact that this came to me intuitively a sign of growth?


Problem C RemovevomeR

Initially, I thought that greedily erasing from the inside might work, but that wasn’t the case at all. I realized there are cases where you erase the outside to move towards an ABA shape, so I dismissed that idea…

Let’s do some experiments.

Obviously, the answer is 11 if there is only 00s or 11s.

First, if the blocks of 00s and 11s are completely separated (ex.  1110000ex. \; 1110000), the answer is 22.

Next, if one block of 00s or 11s is sandwiched by the other (ex.  1110001ex. \; 1110001), the answer is 11.

After this (ex.  110010,  11001001ex. \; 110010, \; 11001001), the answer remains 11 in the same way. (In the case of 110010110010, the image is that you keep erasing 11s and eventually 00s remain.)

In short, if the bits flip exactly once, the answer is 22; otherwise, it is 11.


Problem D An Alternative Way

I don’t mean to be rude, but I really want to complain—is it just that my English or reading comprehension is poor? Didn’t the problem statement seem incredibly hard to read? Well, putting that aside.

To summarize the problem, you perform the following operation on array AA any number of times:

  1. Choose a range [l,r]  (1lrN)[l, r] \; (1 \le l \le r \le N).

  2. For all i  (lir)i \; (l \le i \le r), update A[i]A[i] as follows:

    • If ii is even, A[i]+=1A[i] \mathrel{+}= 1
    • If ii is odd, A[i]=1A[i] \mathrel{-}= 1

The question is whether you can eventually make A=BA = B.

  • Since lrl \le r, it is possible to keep adding 11 to any single element. From this, if A[i]B[i]  (1iN)A[i] \le B[i] \; (1 \le i \le N), the answer is always Yes.

  • A single operation can only result in a change of ±0\pm 0 or +1+1 relative to the entire array AA.

Based on these, if it satisfies i=1N  A[i]B[i]    0\sum\limits_{i=1}^{N} \; A[i] - B[i] \; \ge \; 0, the answer is Yes.


I fell asleep at this point, so I couldn’t solve Problem E or beyond.

As usual, I keep getting CE because I forget to comment out itertools. I really need to stop doing that, but while shifting the blame and thinking it’s the environment’s fault for not having it, I’ll plan to participate in CF again.

See you.