longrange's blog

By longrange, history, 14 months ago, In English

Reference to link

My solution is to sort the distances and arrange them in a cyclic order(except the last one). Then add edges of negative weight to minimize the sum. This yields the answer to be -1*(max_element in distances) [except when n=2]. What is wrong with my algo?

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

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

Hey bro, ur algorithm misses a lot of negative edges that you can put in. Just read the editorial for the question.

  • »
    »
    14 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thanks. I'll try to think of it

    • »
      »
      »
      14 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Do you know what an editorial is and where you can find it?

      • »
        »
        »
        »
        14 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        yes. But I refrain from reading them

        • »
          »
          »
          »
          »
          14 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Why do you refrain from reading editorial but instead ask question on codeforces? That's like not wanting to read editorial but just asking for a different editorial from a different person instead.