Division of Goods
Statement
Alph, Brittany, and Captain Charlie are rationing their supplies of fruit juice.
The crew have a certain number of containers full of juice on a shelf, with some containers storing more nutritional value than others. These are all the supplies they will have for the next <<three>> days. The crew wishes to consume <<roughly the same amount>> of nutrition every day, and to have a single day's containers be <<contiguous>>, because the shelf's design allows only the leftmost container currently on the shelf to be removed.
Given a depiction of the shelf, place two "{{|}}" characters between the locations on the shelf such that the shelf is divided into three sections with the sums of the three sections having the <<least possible range>> and each section having at least one container.
It is guaranteed that there is exactly one unique solution that minimizes range.
Input description
<<Line 1:>> One integer [[N]], the number of containers on the shelf.
<<Line 2:>> The shelf, containing [[N]] space-separated integers [[C_i]], the nutritional value stored by each container.
Output description
<<Line 1:>> The same shelf (line 2 of input) with two "{{|}}" characters inserted at the optimal positions.
<<There is exactly one correct output for each test case.>>
Constraints
3 ≤ [[N]] ≤ 25
1 ≤ [[C_i]] ≤ 10 000 000
Game modes
Test cases
Zero Range, Equal Size Test
Input
6
5 5 3 7 8 2
Output
5 5 | 3 7 | 8 2
Validator 1 Validator
Input
6
49 51 37 63 69 31
Output
49 51 | 37 63 | 69 31
Zero Range, Unequal Size Test
Input
8
10 6 4 20 6 4 4 6
Output
10 6 4 | 20 | 6 4 4 6
Validator 2 Validator
Input
8
100000 60000 40000 200000 60000 40000 40000 60000
Output
100000 60000 40000 | 200000 | 60000 40000 40000 60000
Scarce Test
Input
3
1 10 100
Output
1 | 10 | 100
Validator 3 Validator
Input
3
2384957 9384027 8693948
Output
2384957 | 9384027 | 8693948
Superfood Test
Input
13
1 1 1 1 1 1 1 1 1 1 999 3 3
Output
1 1 1 1 1 1 1 1 1 1 | 999 | 3 3
Validator 4 Validator
Input
13
1 2 3 4 5 9999999 6 7 8 9 8 7 6
Output
1 2 3 4 5 | 9999999 | 6 7 8 9 8 7 6
Max Capacity Test
Input
25
12 43 92 85 10 29 48 50 82 75 20 49 18 57 82 99 20 39 48 57 19 28 57 93 22
Output
12 43 92 85 10 29 48 50 82 | 75 20 49 18 57 82 99 | 20 39 48 57 19 28 57 93 22
Validator 5 Validator
Input
25
5700 5771 5735 5706 5697 5735 5726 5717 5698 5727 5760 5735 5696 5727 5698 5753 5760 5728 5726 5707 5688 5763 5770 5721 5690
Output
5700 5771 5735 5706 5697 5735 5726 5717 5698 | 5727 5760 5735 5696 5727 5698 5753 5760 | 5728 5726 5707 5688 5763 5770 5721 5690
Bias Test
Input
25
999 999 1 2 999 3 2 3 2 1 999 8 2 9 7777777 1 7777777 2 7777777 999 2 4 2 3 1
Output
999 999 1 2 999 3 2 3 2 1 999 8 2 9 7777777 | 1 7777777 2 | 7777777 999 2 4 2 3 1
Validator 6 Validator
Input
25
5322 5324 5323 5325 5323 6320 532098 5323 532098 5322 532098 5330 5323 5329 6320 5322 5323 5324 5323 5324 6320 5323 5322 6320 6320
Output
5322 5324 5323 5325 5323 6320 532098 | 5323 532098 5322 | 532098 5330 5323 5329 6320 5322 5323 5324 5323 5324 6320 5323 5322 6320 6320
Solution language
Solution
Stub generator input