Tạo ra $2 \times n$ độ dài $a_i$ và $a_i - b_i$, rồi chọn ra tổng của 2 giá trị lớn nhất. Cách làm này có thể xử lí cả 2 trường hợp:
- Đáp án chính là độ dài của một gậy.
- Đáp án được ghép lại từ hai gậy.
Create two arrays of length $2 \times n$: $a_i$ and $a_i - b_i$, then select the sum of the two largest values. This method can handle both cases:
- The answer is the length of a single stick.
- The answer is formed by combining two sticks.