TuHoangAnh's blog

By TuHoangAnh, history, 6 weeks ago, In English

in this problem 1682B - AND Sorting, with the input:

1

8

0 1 2 7 4 5 3 6

it seems like the answer is not correct, if im wrong, pls point out my mistakes.

 
 
 
 
  • Vote: I like it
  • -13
  • Vote: I do not like it

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

It's correct. Only 3,6,7 are out of place. You need to swap them to make them occupy correct location. Their AND value is 2 which is the answer. Code for reference : 158037115

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    but there is no way to make them occupy correct location with the value 2.

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

      Swap digits 2,7. Now swap digits 2,3. Now swap digits 2,6. Now swap digits 2,7