spoj problem mixtures done with dp