Codeforces Round 1133 (Div. 1, Div. 2) is coming soon! Register here. ×

JasonMendoza2008's blog

By JasonMendoza2008, history, 2 years ago, In English

This problem https://codeforces.me/contest/285/problem/B says "Consider all glasses are moving simultaneously during one shuffling operation.".

I don't understand how simultaneously makes sense, I solved the problem assuming one shuffling operation means moving the glasses in sequence* but I was just wondering if there is something I misunderstood.

* "if glass at position 1 goes from 1 to 2 and glass at position 2 goes from 2 to 3 then if marble was in glass at position 1 it ends up in glass at position 3" was my assumption.

Thank you for your help.

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

| Write comment?
»
2 years ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

No, this isn't wrong. It means all glasses move in one moment

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

    But then if they all move in one moment and we take back my example the marble would end up at position 2 right? because we swap 1 and 2 at the same time we swap 2 and 3. Which would barely make sense because where would glass 2 end up, in 1 or in 3? I'm sorry if I still miss something.

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

      You have array p that clearly says where glass sould go. Glass that was on 1 would go to p[1] and glass that was on 2 would go to p[2]...