Company: Visa_21_feb
Difficulty: medium
Total Team Efficiency A hackathon has skillCount participants standing in a line. The i -th participant has a skill rating skill[i] . The organisers want to split all of the participants into teams of exactly two, so that: every participant belongs to exactly one team, and every team has the same total skill — that is, if one team is [a, b] and another is [c, d] , then a + b = c + d . The efficiency of a team [a, b] is a * b . Report the sum of the efficiencies of all the teams. If the participants cannot be split into teams this way at all, report -1 . Input Format The first line contains a single integer skillCount — the number of participants. The second line contains skillCount space-separated integers skill[0], skill[1], ..., skill[skillCount - 1] — the skill ratings. Output Format Print a single integer — the sum of the efficiencies of all the teams, or -1 if no such split exists. Constraints 1 <= skillCount <= 10^5 1 <= skill[i] <= 10^5 skillCount is not guaranteed t