All submissions for this problem are available.
The "He-Man" Gymnasium, Jabalpur wants to organise a weight-lifting competition.
The weight discs will be placed on the ends of a single long weight lifting bar.
The competitor lifts the weight bar by holding it in the middle ( like on the practice problems page of Codechef ! ).
The problem is, the Gymnasium does not have weight discs of equal weight in equal numbers.
Manager Monnu wants to determine the maximum weight that can be used in the competition. Obviously the weight has to be equal on both sides of the bar!
Given a list of the weights of the discs available in the gymnasium, find the maximum weight that a participant may have to lift.
The first line gives t the number of test cases (t ≤ 100).
Then t test cases follow.
For each test Case:
The first line gives n, the number of weight discs in the gym. (2 ≤ n ≤ 60)
The next line contains n integers which give the weights of the n discs. The total weight of the weight discs in the gymnasium is less than 600000
For each test case output a single line, giving the maximum amount of weights the can be put on both sides of the bar
Input: 1 5 10 7 8 2 4 Output: 12
|Time Limit:||12.8052 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, ERL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.