This problem is similar to question "Luggage" somewhere here in UVa, but when applying widely-known DP strategy that worked there (and in may-may other places) I got TLE in "Dividing Up". So your explanation was of great moment to me.
I see that in reducing counters of n1, n2, n3 you reasoned in terms of Dirichlet principle (or whatever else it's called):
"If nm+1 objects are placed into n boxes, then some box contains more than m boxes",
but my question here:
Why it is that we can not reduce n4, for instance, to 5, this way:
if (n4==5) => (there are at least 3 in one hand ) => (we can replace 3 4-balls by 2 6-balls)?
Of course it's too great a hint, but am I right that in reducing n3 to 3 we replace 2 3-balls by 1 6-ball?
Thank you.