Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

ARC180 Proof of Problem A Parity Inversion

Правка en1, от EternalWisdom, 2024-07-11 15:38:37

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.

Теги atcoder, permutations, inversions, string, parity

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский EternalWisdom 2024-07-11 15:38:37 1208 Initial revision (published)