Round 1131 E

Revision en1, by Goldenfield19, 2026-11-05 04:43:35

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)

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Goldenfield19 2026-11-05 04:43:35 388 Initial revision (published)