EternalWisdom's blog

By EternalWisdom, history, 12 months ago, In English

This is the Problem A from the latest ARC, ARC 180 Problem A ABA and BAB The editorial talks about some parity inversion technique. In competitive programming, a well-known technique is using parity to perform inversions. Let’s apply it to this problem.

I understand that the technique is not required for solving the problem and It is possible to get the result by just observing the lengths of alternating characters and multiplying them together. However, I was interested in the Proof of the Claim given in the editorial. The claim is- Specifically, let’s invert the characters A and B only at even positions in the input string. __ Then, the two available operations become the following: __ AAA → A BBB → B With this transformation, the solution becomes almost obvious. For a contiguous segment of A or B, as long as its length does not become zero, we can reduce the length by 2 each time.

The solution after the the transformation is obvious. But how can you prove that the transformation preserves the result of the problem.

Any Help is appreciated.

  • Vote: I like it
  • +5
  • Vote: I do not like it

»
39 hours ago, hide # |
Rev. 2  
Vote: I like it -10 Vote: I do not like it

I had noticed in between plagiarism check of Codeforces Round 1033 that your submissions were skipped but later on they got accepted. Can let me know how did your submissions got accepted later on. My fiend's contest has also been skipped in the same contest and he is sure none of his answers were neither AI generated nor copied from elsewhere. Help him whom to contact or how to resolve this issue.

  • »
    »
    34 hours ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Click Here to see the screenshot of what I had seen during Plagiarism check