hello_its_me's blog

By hello_its_me, 3 months ago, In English

Distinct Sums Grid
I tried then searched for the solution online but could not find it anywhere. If anybody has solved it please do share the solution here or in private. Thanks in advance.

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

»
3 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I am stuck on the first two first two problems like I know what to do, but just cant implement it, please help

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

    for the first one try to go greedy. take all the elements in a dq and use the largest element in the dq if the number of inversions needed is more than the remaining elements. if this sounds confusing you can take a look at the code :

    Code

    The second is just intuition or observation just to say. Try to think when the case is impossible. Rest of the logic follows.

    Hint

    If you are still stuck :

    Code
»
3 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

Let's maybe not blidnly downvote this, it's a nice problem and the only solution I've seen is not too satisfying (which linked in the comments and uses random swaps).

It would be interesting to know a deterministic (number theoretic / D&C / latin square)-based solution.

»
3 months ago, hide # |
Rev. 4  
Vote: I like it 0 Vote: I do not like it

Sorry, this answer was wrong.