remastered's blog

By remastered, history, 2 hours ago, In English

My slow solution 291665439 to 2031D - Penchick and Desert Rabbit passes the system tests.

Explanation
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
68 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

my O(n^2) brute force solution 291699055 also got accepted for 2031B - Penchick and Satay Sticks

  • »
    »
    55 minutes ago, # ^ |
    Rev. 3   Vote: I like it 0 Vote: I do not like it

    This is actually a valid $$$\mathcal{O}(n)$$$ solution. With the if condition any element will not move more than one place from the initial order so the loop never runs more than twice through the entire array.