WA [granama]

,

hey all… my code is giving WA at codechef… CodeChef: Practical coding for everyone
and AC at ideone… 6Kaxiv - Online C Compiler & Debugging Tool - Ideone.com

problem: GRANAMA Problem - CodeChef
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… 9nVgi2 - Online C Compiler & Debugging Tool - Ideone.com

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-dXd8TH - Online C++ Compiler & Debugging Tool - Ideone.com


+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: