I'm trying to divide $m$ elements into $n$ groups. Each of the $m$ elements has its own weight. Those elements should be divided into $n$ groups, where following conditions should be met:

* groups contain elements **in the same order** as the given list of elements
* The difference in group weight should be minimal
* groups consist of elements wich follow eachother, without skipping any. as in A and C in one group without B would be invalid. B should be in that group aswell

An example:

elements:

* A: weight = 100
* B: weight = 200
* C: weight = 150
* D: weight = 75

number of groups: 3
should be grouped as: A, B, CD