@sunny Ok , Thanks On Jul 3, 12:58 pm, sunny agrawal <sunny816.i...@gmail.com> wrote: > You should have posted the problem link > i think u are trying this one. <http://www.codechef.com/problems/MULTQ3/> > > <http://www.codechef.com/problems/MULTQ3/>use RMQ or Binary Indexed Trees. > Brute Force won't work > > On Sun, Jul 3, 2011 at 1:17 PM, rajeevrvis <rajeev.open.1...@gmail.com>wrote: > > > > > > > > > > > Hi Here is the code . I want to optimize it to run faster . > > Can Anyone help me??? > > > #include<stdio.h> > > void main() > > { > > int n,q,a[100000]={0},b[100000],c[100000],d[100000],i,count,j; > > scanf("%d%d",&n,&q); > > for(i=0;i<q;i++) scanf("%d%d%d",&b[i],&c[i],&d[i]); > > for(i=0;i<q;i++) > > if(b[i]==0) > > { > > for(j=c[i];j<=d[i];j++) > > a[j]=a[j]+1; > > } > > else > > { > > count =0; > > for(j=c[i];j<=d[i];j++) > > if(a[j]%3==0) > > count++; > > printf("%d\n",count); > > } > > } > > > Regards > > > rajeevrvis > > > -- > > You received this message because you are subscribed to the Google Groups > > "Algorithm Geeks" group. > > To post to this group, send email to algogeeks@googlegroups.com. > > To unsubscribe from this group, send email to > > algogeeks+unsubscr...@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/algogeeks?hl=en. > > -- > Sunny Aggrawal > B-Tech IV year,CSI > Indian Institute Of Technology,Roorkee
-- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.