sorry, dont bother, I got it. On Fri, Mar 11, 2011 at 5:39 PM, Harshal <[email protected]> wrote:
> any test case where this fails by using brute force approach? like this one > if c[l]<=c[r] then take c[l]*a and l++; else choose c[r]*a and r--; this is > o(n) solution. > any test case where it fails?? > > On Thu, Mar 10, 2011 at 11:40 AM, Amol Sharma <[email protected]>wrote: > >> Bhaukali Launde !! >> >> Maa ka ladla bigad gya !! >> >> >> On Thu, Mar 10, 2011 at 11:36 AM, UTKARSH SRIVASTAV < >> [email protected]> wrote: >> >>> thnx ashutosh ..................tum i love u >>> >>> >>> On Thu, Mar 10, 2011 at 11:11 AM, AnAnDiT AsHu <[email protected]>wrote: >>> >>>> launda pelu nikla..... >>>> >>>> On Thu, Mar 10, 2011 at 10:22 AM, UTKARSH SRIVASTAV < >>>> [email protected]> wrote: >>>> >>>>> WELL I HAVE DONE THIS PROBLEM .HERE IS THE CODE >>>>> #include<stdio.h> >>>>> #include<algorithm> >>>>> using namespace std; >>>>> main() >>>>> { >>>>> long long int t[2][2010],price[2010],r,c,i,j,n; >>>>> scanf("%lld",&n); >>>>> for(i=0;i<n;i++) >>>>> { >>>>> scanf("%lld",&price[i]); >>>>> } >>>>> for(r=n-1,c=0;r>=0&&c<=n-1;r--,c++) >>>>> { >>>>> for(i=r,j=n-1;i>=0&&j>=c;j--,i--) >>>>> >>>>> t[i&1][j]=max(price[i]*(n+i-j)+t[(i+1)&1][j],price[j]*(n+i-j)+t[i&1][j-1]); >>>>> } >>>>> printf("%lld\n",t[0][n-1]); >>>>> return 0; >>>>> >>>>> } >>>>> >>>>> >>>>> >>>>> On Wed, Mar 9, 2011 at 5:10 PM, Algoose chase <[email protected]>wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> Any solution other than brute force(exponential growth) for this >>>>>> problem ? >>>>>> >>>>>> >>>>>> On Sun, Mar 6, 2011 at 6:42 PM, UTKARSH SRIVASTAV < >>>>>> [email protected]> wrote: >>>>>> >>>>>>> can anyone please tell me why i am getting wrong answer for >>>>>>> problem.....https://www.spoj.pl/problems/TRT/ >>>>>>> . >>>>>>> . >>>>>>> . >>>>>>> MY CODE IS THIS AND TO BE TESTED IN gcc COMPILER >>>>>>> >>>>>>> >>>>>>> #include<stdio.h> >>>>>>> double a[2100]; >>>>>>> double fun(long long int m,long long int n,double count) >>>>>>> { >>>>>>> double k,l; >>>>>>> count++; >>>>>>> if(m==n) >>>>>>> { >>>>>>> >>>>>>> return count*a[m]; >>>>>>> } >>>>>>> if((k=(fun(m+1,n,count)))>(l=(fun(m,n-1,count)))) >>>>>>> { >>>>>>> >>>>>>> return (count*a[m]+k); >>>>>>> } >>>>>>> else >>>>>>> { >>>>>>> >>>>>>> >>>>>>> return (count*a[n]+l); >>>>>>> } >>>>>>> } >>>>>>> int main() >>>>>>> { >>>>>>> long long int i,m,n; >>>>>>> double ans,c=0; >>>>>>> scanf("%lld",&n); >>>>>>> for(i=1;i<=n;i++) >>>>>>> { >>>>>>> scanf("%lf",&a[i]); >>>>>>> } >>>>>>> m=1; >>>>>>> ans=fun(m,n,c); >>>>>>> printf("%.0lf\n",ans); >>>>>>> return 0; >>>>>>> } >>>>>>> >>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "Algorithm Geeks" group. >>>>>>> To post to this group, send email to [email protected]. >>>>>>> To unsubscribe from this group, send email to >>>>>>> [email protected]. >>>>>>> For more options, visit this group at >>>>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>>>> >>>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Algorithm Geeks" group. >>>>>> To post to this group, send email to [email protected]. >>>>>> To unsubscribe from this group, send email to >>>>>> [email protected]. >>>>>> For more options, visit this group at >>>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> UTKARSH SRIVATAV >>>>> CSE-3 >>>>> B-TECH 2nd YEAR >>>>> MNNIT ALLAHABAD >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Algorithm Geeks" group. >>>>> To post to this group, send email to [email protected]. >>>>> To unsubscribe from this group, send email to >>>>> [email protected]. >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Algorithm Geeks" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]. >>>> For more options, visit this group at >>>> http://groups.google.com/group/algogeeks?hl=en. >>>> >>> >>> >>> >>> -- >>> UTKARSH SRIVATAV >>> CSE-3 >>> B-TECH 2nd YEAR >>> MNNIT ALLAHABAD >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > > > -- > Harshal Choudhary, > III Year B.Tech Undergraduate, > Computer Science and Engineering, > National Institute of Technology Surathkal, Karnataka > India. > > -- Harshal Choudhary, III Year B.Tech Undergraduate, Computer Science and Engineering, National Institute of Technology Surathkal, Karnataka India. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
