Thanx Sharad finally got AC *Anshul Agarwal Nit Allahabad Computer Science** *
On Tue, Dec 20, 2011 at 3:16 PM, sharad dixit <sharad.emine...@gmail.com>wrote: > @Anshul AGARWAL > > Input : > 4 > 2 1 3 4 > > Expected Output : > Yes > > Your's Code Output : > No > > On 12/20/11, sunny agrawal <sunny816.i...@gmail.com> wrote: > > @ Anshul > > it will be nice if you post your logic rather than Code, and also Code > > posting without logic and comments is not allowed in the group. i > > don't know who approved this post but take care of this from next > > time. > > > > On Tue, Dec 20, 2011 at 7:41 PM, Anshul AGARWAL > > <anshul.agarwa...@gmail.com> wrote: > >> problem:street parade: http://www.spoj.pl/problems/STPAR/ > >> my code give correct answer for all test case that i run but still it > give > >> WA. plz provide me more test cases . > >> my code is > >> > >> > >> #include<stdio.h> > >> #include<iostream> > >> #include<algorithm> > >> using namespace std; > >> int main() > >> { > >> int n,a[1010],b[1010],s[1010],t=0,q=1; > >> scanf("%d",&n);//2 1 4 3 > >> > >> while(n) > >> { int i=0,f=0,j=0; > >> q=1;t=0;s[0]=100001; > >> for(i=0;i<n;i++) > >> { > >> scanf("%d",&a[i]); > >> b[i]=a[i]; > >> } > >> sort(a,a+n); > >> for(i=0;i<n;i++) > >> { > >> if(i<(n-1)&&a[i]==a[i+1]) > >> { > >> f=1;break;} > >> if(s[t]==a[j]) > >> { > >> j++; > >> t--; > >> } > >> > >> else if(b[i]==a[j]) > >> { > >> j++; > >> } > >> else > >> { > >> if(s[t]==a[j]) > >> { > >> j++; > >> t--; > >> if(t==0) > >> > >> s[0]=100001; > >> } > >> else if(s[t]<b[i]) > >> { > >> f=1; > >> break; > >> } > >> else > >> { > >> if(t==0&&s[0]==100001) > >> { > >> s[t]=b[i]; > >> }else > >> { > >> t=t+1; > >> s[t]=b[i]; > >> } > >> } > >> } > >> > >> } > >> while(t>=0&&s[0]!=100001) > >> { > >> if(s[t]==a[j]) > >> { > >> t--; > >> if(t==0) > >> > >> s[0]=100001; > >> j++; > >> } > >> else > >> { > >> f=1; > >> break; > >> } > >> } > >> > >> if(f==1) > >> printf("no\n"); > >> else > >> { > >> > >> > >> printf("yes\n"); > >> } > >> scanf("%d",&n); > >> } > >> } > >> > >> Thanx in advance > >> > >> Anshul Agarwal > >> Nit Allahabad > >> Computer Science > >> > >> -- > >> 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. V 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. > > > > > > > -- > - Sharad Dixit > B.Tech(IT) > Indian Institute of Information Technology, > Allahabad > 3rd year > > -- > 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. > > -- 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.