soda_bottle's blog

By soda_bottle, history, 3 years ago, In English

Problem E — Can anyone tell me how to get the answer in 4 moves for the following input? 8 6 6 1 6 3 1 8 8 10, AC program outputs 4. Link to problem — https://codeforces.com/contest/1481/problem/E

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

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

Is there an error with the official solution?

»
3 years ago, # |
  Vote: I like it +1 Vote: I do not like it

Initially: $$$a = [8,6,6,1,6,3,1,8,8,10]$$$.

Move $$$8$$$ from the front to the back, $$$a = [6,6,1,6,3,1,8,8,10,8]$$$.

Move $$$10$$$ to the back, $$$a = [6,6,1,6,3,1,8,8,8,10]$$$.

Move $$$1$$$ to the back, $$$a = [6,6,6,3,1,8,8,8,10,1]$$$.

Move the other $$$1$$$ to the back, $$$a = [6,6,6,3,8,8,8,10,1,1]$$$.