WA [granama]

,

hey all… my code is giving WA at codechef… http://www.codechef.com/viewsolution/2364571
and AC at ideone… http://ideone.com/6Kaxiv

problem: http://www.codechef.com/problems/GRANAMA
checked it several times but in vain… plz help

In the piece of code


memset(aa,28,0);
memset(bb,28,0);

use instead


memset(aa,sizeof(aa),0);

memset(bb,sizeof(bb),0);


In memset the the second value represents the no of bytes so it should be either 28into4 or 28intosizeof(int) or simply sizeof(array).Note:u are only flushing 1/4th of the array So maybe WA.Reply if it does not solve ur problem.

1 Like

@sparshgunner12 : i made some changes to the code… still WA… http://ideone.com/9nVgi2

Here is my accepted solution .I think it should be easy to understand.Still if it is not,do reply.But i would suggest u look at it after working on ur own code.


LINK-http://ideone.com/dXd8TH


+there is no need to use memset aa[29]={0},bb[29]={0} does the trick;

1 Like

seems it does not work for output aabbb and aaabb.It says YES but ans should be NO.

i am doing it myself so it might take a while.

@sparshgunner12: thanks a lot buddy… it helped me a lot.

@sparshgunner12: thanks buddy… it helped me a lot… :slight_smile: