Marks :20
: 0 | : 0
There are $$$N$$$ candidates with skills as $$$skill[i]$$$ denoting skill of $$$i_{th}$$$ candidate.
A total of $$$N/2$$$ teams are to be formed with 2 people each and no person can be in the same team as well as each person has to be in some team. and also sum of skills of team members in each team should be same
Then efficiency of team is defined as product of skills of team members. Your task is to find the efficiency of formed teams which is sum of efficiency of each team. If $$$N/2$$$ teams cannot be formed as per above condition then output -1.
The first line contains a single integer $$$1\le N \le 10^{5}$$$. The second line contains $$$N$$$ space separated integers denoting the $$$skill$$$ array where $$$i_{th}$$$ integer represent $$$1\le skill[i] \le 10^{5}$$$ denoting skill of $$$i_{th}$$$ candidate.
Output sum of efficiency of valid team formation or output -1 if valid team formation is not possible.
6 2 1 1 4 3 4
14
4 5 4 2 1
13
5 2 1 4 3 5
-1
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.