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:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, COB, CPP 4.3.2, CPP 6.3, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, kotlin, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYPY, PYTH, PYTH 3.5, RUBY, rust, SCALA, SCM chicken, SCM guile, SCM qobi, ST, swift, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.