You are not logged in. Please login at www.codechef.com to post your questions!

×

Help in Codeforces problem Pasha and String

In the editorial of the problem Pasha and String, the author makes a claim that, "it doesn't matter in which order make reverses, answer will be the same for all orders." What is the reasoning behind this statement? Is it because the rotation of string is always symmetric about the center(from the position i to |s| - i + 1)?

asked 20 Mar '18, 18:13

sorb1997's gravatar image

4★sorb1997
1509
accept rate: 10%

edited 20 Mar '18, 18:14


Yes, that is correct. A rotation causes changes in positions of characters, but a character at $i$ is always swapped with that at $|s|-i+1$. So the only thing which is important with regard to a pair of positions $(i, |s|-i+1)$ is the number of rotations that affect them.

link

answered 20 Mar '18, 19:07

meooow's gravatar image

6★meooow ♦
7.1k718
accept rate: 48%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×1,000
×672
×643

question asked: 20 Mar '18, 18:13

question was seen: 185 times

last updated: 20 Mar '18, 19:07