Replace
if(x>=y)
{
m[i][j]=x;
//cost=wt[i];
ans[i][j]=wt[i]+ans[i-1][j-wt[i]];
}
with
if(x>y){
m[i][j] = x;
ans[i][j] = wt[i]+ans[i-1][j-wt[i]];
}else if(x==y){
m[i][j] = x;
ans[i][j] = min(ans[i-1][j] , ans[i-1][j-wt[i]]+wt[i
hey guys.., i tried solving this problem http://www.spoj.pl/problems/PARTY/
i get answer for the test cases that i try.. getting WA in the judge..
can anyone help me out here.. my code is as follows..
#include
#include
using namespace std;
int m[150][150],v[150],wt[150],ans[150][150];
void dp(i