Goldenfield19's blog

By Goldenfield19, history, 9 hours ago, In English

i starts from 1; Noticing that sum((-1^i) * v[i]) doesn't change overall, so we can construct b[i] = -1^i * v[i] and let the biggest ceil(n/2) elements be on the positive slot and then count the result

The ans would then be sum(positive half) + sum(negative half), as sum(negative half) = sum(b) — sum(positive half), so the answer is 2*sum(positive) — sum(b)

Full text and comments »

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