i have tried almost all test cases on forum and 'am getting correct ans for them.I have also increased my array sizes as advised but 'am still getting WA plzz help my code :
GOT AC!!!!
problem : Party Schedule
int sum=0,b=budget ; for(i=n;i>0;i--) { if(f[i][b]!=f[i-1][b]) { sum=sum+fee[i-1] ; b=b-fee[i-1] ; } else { for(j=0;j<i-1;j++) if(fun[j]==fun[i-1]&&fee[i-1]<fee[j]) fee[j]=fee[i-1] ; } }
This is not necessarily optimal.
i m sorry but i do not understand.This is my first dp bottom up way........i think i may hv messed up with the algo.......i will be grateful if u can give me test case which fails so that i can understand better .......thank u
Ignoring the constraint of the cost of an event being between 5 and 25, you fail some of these test casestc.txt (3.6 KB)
thank u very much leppyr64 ....!! u were right ..my optimization was wrong ......rectified it and got AC !!!!!!