Distribute

Submit

Your name:
File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

Problem

Distribute numbers to two persons (left, right).
Try to distribute the numbers equally so that the sum
of the left list 'tries' to be the same of the right list.
Once you gave a person a number you can not take it back.
(This yields to unequal distribution even if an equal distribution would be possible.) Left person has priority
over right person.

-- mroman

Options

exec is denied

now post-mortem time, all source codes will be revealed

Sample input:_

[1,1]
[1,2,3]
[5,1,1,1]
[1,2,3,4,5,6,7,8,9]
[1,2,1,2,1,2,1,2,1]
[0,1,0,0,0]
[0,1,0,0,0,1]
[1,1,3,1,1,1]

Sample output:

([1],[1])
([1,3],[2])
([5],[1,1,1])
([1,3,5,7,9],[2,4,6,8])
([1,1,2,1,2],[2,1,2,1])
([0,1],[0,0,0])
([0,1],[0,0,0,1])
([1,3],[1,1,1,1])

Sample input:_

[39,85,35,82,63,10,90,50]
[1,88,19,81,69,29,14,15,10,65]
[77,34,83,60,87,86]
[58,41,27,40,88,14]
[40,66,27,17,73,4,31,14,71,62]
[40,46,56,52,17,10,13,79,55]
[13,21,16,41,66,56,57,5]
[25,80,6,29,69,47,55]
[6,71,55,43,41]
[19,73,9,3,15,23,45]
[66,50,6,27,70,77]
[22,74,74,58,4,9,9,79]
[10,26,16,4,6,64,36,56,32,15]
[57,38,24,87,74]
[38,15,62,55,18]
[39,79,83,40,62,63,56,32]
[7,66,63,4,78,24,49,20]
[38,1,46,6,59,5,86,63,5]
[33,52,23,32,7,64]
[74,7,28,87,57]
[71,78,30,12,36,60]
[55,74,60,52,43]
[87,31,1,66,43]
[51,74,35,26,7,41]
[31,24,51,20,1,47,86]
[28,54,70,60,61,77]
[8,25,80,89]
[53,54,81,56,45,41,1]
[31,15,4,19,12]
[82,72,28,81,78,5,63,57,30]
[50,81,89,58]
[19,12,2,72,65,13,27,36]
[55,38,44,46]
[53,23,25,27,17,20,16,81,62]
[54,30,81,61,72,21]
[41,83,49,86]
[67,48,4,70,58,27,89]
[50,67,71,18,60,17,18,87,76]
[50,9,76,17,83,29]
[34,4,54,52,50,6]
[39,43,42,15,9,65,66]
[47,43,64,12,35,26]
[10,40,35,85,26,11,11]
[12,20,78,69,31,12,70,49]
[80,57,63,27,55,85,16,75]
[58,41,25,14,54,25,58]
[68,49,88,73,73,29,45]
[25,2,90,50,15,52,88,38]
[5,57,55,48,79,81,26,43]
[17,18,87,18,28]
[37,85,84,4,4,50]
[75,36,80,46,76,52,43,25,26]
[39,30,71,25,72,72,4,36]
[81,56,46,45,88,6]
[80,35,59,21]
[23,35,81,81]
[41,47,42,40,41]
[52,23,20,74,56,34,89,46,83]
[66,26,43,13,42]
[66,90,45,77,67,26,78]
[14,84,35,22,69,14,22,9]
[11,42,9,43,80,15,69,42]
[22,59,80,50,90,7]
[64,52,53,59,61,39,73,48]
[43,63,81,39,55,43,20,52,38,40,74]
[83,67,81,5]
[6,86,16,79,83,39,8,42,1,17]
[26,9,53,71,89,38,25,62]
[64,17,72,16,31,2]
[73,40,56,19,26,32,72]
[81,2,59,25,42,48,58,1]
[29,71,16,83,59,74]
[76,10,73,69,47]
[74,48,70,66,61]
[48,42,66,25,67]
[34,29,64,56,88]
[74,12,52,31,61,29,78]
[59,20,53,7,82,33,42,17,26]
[7,24,33,21,84,62,45,22]
[67,41,59,53,35,43,26,18,23]
[83,79,57,56,14,62,42,79,52,58]
[66,16,33,2,63,45,67,18,56,23]
[8,87,74,67]
[51,77,29,34,27,25]
[44,12,72,90,39,28,58,64,80]
[8,48,21,21,9,80,17,19,60,71,40]
[83,87,7,85,38]
[26,40,87,42,65,60]
[10,86,63,38,32]
[18,18,26,44,12,63]
[57,6,32,13,88,73,23,4]
[54,8,36,18,11,43,15]
[74,63,48,86,13,17,14]
[28,78,41,67,68,25,46,40,51]
[12,49,2,32,51,19]
[18,40,70,77,65,29,43]
[51,40,64,28,44]
[13,52,63,85,5]
[32,71,14,8,86,62,34,58,31]
[53,1,7,16]
[31,2,75,54,58,30,81,8]
[63,3,32,45,71,26,64,81]
[42,6,23,57,15,30,83]
[42,65,25,75,65,43,62]
[39,22,73,16,6,70,80]
[42,87,89,87,28,22,48]
[20,37,19,5,38,3]
[21,67,23,36,41,75,44,69,6,11]
[52,47,13,66,10]
[65,15,48,7,36]
[69,37,37,59,45,6]
[63,8,14,32,86,2,51,55,71]
[86,73,15,12]
[1,51,77,69,58,55,21]
[1,25,26,59,88]
[33,64,50,51,62]
[14,58,23,27,15,44]
[24,27,63,44,37,66,81,5]
[13,76,80,46,7,83,47,59]
[24,57,3,9,32,8,84]
[3,20,25,1,32]
[83,62,13,43,41,22]
[88,60,18,56,88]
[32,16,56,83,9]
[76,46,47,35,77,48,65,38]

Sample output:

([39,35,82,90],[85,63,10,50])
([1,19,81,29,14,15,65],[88,69,10])
([77,60,86],[34,83,87])
([58,40,14],[41,27,88])
([40,27,73,62],[66,17,4,31,14,71])
([40,56,17,79],[46,52,10,13,55])
([13,16,66,57],[21,41,56,5])
([25,6,29,69],[80,47,55])
([6,55,43],[71,41])
([19,9,3,15,23,45],[73])
([66,70],[50,6,27,77])
([22,74,4,9,9,79],[74,58])
([10,16,4,64,32],[26,6,36,56,15])
([57,87],[38,24,74])
([38,55],[15,62,18])
([39,83,63,32],[79,40,62,56])
([7,63,78],[66,4,24,49,20])
([38,6,59,63],[1,46,5,86,5])
([33,23,7,64],[52,32])
([74,57],[7,28,87])
([71,30,60],[78,12,36])
([55,60,43],[74,52])
([87,43],[31,1,66])
([51,35,7,41],[74,26])
([31,20,1,47],[24,51,86])
([28,70,61],[54,60,77])
([8,80],[25,89])
([53,81,41],[54,56,45,1])
([31,12],[15,4,19])
([82,81,5,63,30],[72,28,78,57])
([50,89],[81,58])
([19,65,13,36],[12,2,72,27])
([55,46],[38,44])
([53,17,20,81],[23,25,27,16,62])
([54,61,21],[30,81,72])
([41,49],[83,86])
([67,58,89],[48,4,70,27])
([50,71,17,18,76],[67,18,60,87])
([50,17,83],[9,76,29])
([34,52,6],[4,54,50])
([39,42,66],[43,15,9,65])
([47,12,35,26],[43,64])
([10,35,26,11,11],[40,85])
([12,78,12,70],[20,69,31,49])
([80,27,55,16,75],[57,63,85])
([58,14,25,58],[41,25,54])
([68,73,29,45],[49,88,73])
([25,50,15,52,38],[2,90,88])
([5,55,79,26,43],[57,48,81])
([17,87],[18,18,28])
([37,84],[85,4,4,50])
([75,46,52,43,26],[36,80,76,25])
([39,25,72,4,36],[30,71,72])
([81,45,6],[56,46,88])
([80,21],[35,59])
([23,81],[35,81])
([41,42,41],[47,40])
([52,56,34,46,83],[23,20,74,89])
([66,13],[26,43,42])
([66,45,67,78],[90,77,26])
([14,35,22,69],[84,14,22,9])
([11,9,43,15,69],[42,80,42])
([22,80,90],[59,50,7])
([64,59,39,73],[52,53,61,48])
([43,81,43,52,74],[63,39,55,20,38,40])
([83,5],[67,81])
([6,16,79,39,8,42],[86,83,1,17])
([26,71,38,25],[9,53,89,62])
([64,16,31],[17,72,2])
([73,19,26,72],[40,56,32])
([81,42,58],[2,59,25,48,1])
([29,16,83,74],[71,59])
([76,69],[10,73,47])
([74,66],[48,70,61])
([48,25,67],[42,66])
([34,56,88],[29,64])
([74,61],[12,52,31,29,78])
([59,7,82,17],[20,53,33,42,26])
([7,33,84,22],[24,21,62,45])
([67,53,43,23],[41,59,35,26,18])
([83,56,62,52,58],[79,57,14,42,79])
([66,45,67,23],[16,33,2,63,18,56])
([8,74,67],[87])
([51,29,27,25],[77,34])
([44,90,58,80],[12,72,39,28,64])
([8,21,21,80,71],[48,9,17,19,60,40])
([83,7,38],[87,85])
([26,87,60],[40,42,65])
([10,63,38],[86,32])
([18,26,12,63],[18,44])
([57,73,23],[6,32,13,88,4])
([54,11,15],[8,36,18,43])
([74,86],[63,48,13,17,14])
([28,41,67,25,40],[78,68,46,51])
([12,2,32,51],[49,19])
([18,70,65],[40,77,29,43])
([51,28,44],[40,64])
([13,63,5],[52,85])
([32,14,8,86,58],[71,62,34,31])
([53],[1,7,16])
([31,54,30,81],[2,75,58,8])
([63,71,81],[3,32,45,26,64])
([42,15,30],[6,23,57,83])
([42,25,65,43],[65,75,62])
([39,16,6,70],[22,73,80])
([42,89,28,22],[87,87,48])
([20,19,38],[37,5,3])
([21,23,36,75,6,11],[67,41,44,69])
([52,66],[47,13,10])
([65,36],[15,48,7])
([69,59],[37,37,45,6])
([63,2,51,55],[8,14,32,86,71])
([86,12],[73,15])
([1,77,58,21],[51,69,55])
([1,26,88],[25,59])
([33,50,62],[64,51])
([14,23,27,44],[58,15])
([24,63,66,5],[27,44,37,81])
([13,80,7,83],[76,46,47,59])
([24,3,9,32],[57,8,84])
([3,25],[20,1,32])
([83,41],[62,13,43,22])
([88,88],[60,18,56])
([32,83],[16,56,9])
([76,35,48,65],[46,47,77,38])

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1leonid980.03802012/07/20 06:00:560B / 41B / 55B
2clock990.03982012/07/23 02:53:030B / 28B / 66B

Perl _

RankUserSizeTimeDateStatistics
1test1790.13612012/07/13 01:52:180B / ?B / ?B

Python _

RankUserSizeTimeDateStatistics
1hallvabo830.04552012/07/10 23:38:350B / 39B / 33B
2leonid830.04652012/07/11 09:21:050B / 42B / 30B
3recursive830.06242012/07/20 01:46:530B / 48B / 30B
4mroman910.04082012/07/19 22:31:550B / ?B / ?B

J _

RankUserSizeTimeDateStatistics
1I., S.980.10362012/07/13 05:36:440B / 16B / 80B

K _

RankUserSizeTimeDateStatistics
1twobit710.03282012/07/19 21:24:480B / 14B / 56B

C _

RankUserSizeTimeDateStatistics
1kou2190.03072012/07/19 11:15:090B / 99B / 120B

Haskell _

RankUserSizeTimeDateStatistics
1henkma840.03592012/07/11 06:34:040B / 42B / 40B
2I., S.850.03682012/07/11 21:07:410B / 43B / 38B

GolfScript _

RankUserSizeTimeDateStatistics
1tails680.45582012/07/20 23:44:370B / 7B / 61B
2tails670.47112012/07/26 20:05:460B / 7B / 60B

Language Ranking_

RankLangUserSizeScore
1GolfScripttails6710000
2Ktwobit719436
3Perltest1798481
4Pythonhallvabo838072
5Haskellhenkma847976
6JI., S.986836
7Rubyleonid986836
8Ckou2193059

return top