Maximize Score After N Operations

Given an integer array nums of length 2n, perform exactly n operations. In the 1-indexed k-th operation (k = 1, 2, ..., n), choose any two remaining elements x and y, add k * gcd(x, y) to your score, and remove both elements from nums. Maximize the total score after all n operations and return that maximum.

Examples
Input: [1,2]
Output: 1
Hints

Maximize Score After N Operations

Given an integer array `nums` of length `2n`, perform exactly `n` operations. In the 1-indexed k-th operation (k = 1, 2, ..., n), choose any two remaining elements `x` and `y`, add `k * gcd(x, y)` to your score, and remove both elements from `nums`. Maximize the total score after all `n` operations and return that maximum.