remastered's blog

By remastered, history, 4 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

»
3 hours 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

  • »
    »
    3 hours 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.

»
67 minutes ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Sir, teach us your skill of optimizing code!