AmazonOA #71
Maximum Affinity (Region Distribution with Pair Rules)
估计中等评测数据准备中,可先阅读题面
Given affinity[n] (n even) and m rules; each rule (x, y) says "if either index x or y is chosen for a region in one step, the other must be chosen for the opposite region in the next step." Maximize total affinity assigned to regionA over alternating steps (A first).
Constraints
2 ≤ n ≤ 10⁵,neven.-10⁹ ≤ affinity[i] ≤ 10⁹1 ≤ m ≤ n/2