for this question http://www.codechef.com/problems/IGAME , i am getting runtime error(SIGSEGV) with this solution http://www.codechef.com/viewsolution/2366703 . but there are many successful submissions in C for this problem which also uses same amount of memory as i did that is 2-d array of around 1000*1000, like this http://www.codechef.com/viewsolution/1749748. what is the problem with my solution ?
This seems to me as the problem
while(x<=1000 || y<=1000) // Problem lies here
If either of x or y become > 1001 then you’ll access element which has not been allocated as your char array has dimensions 1002 * 1002, it should be “&&” instead of “||”. Hence the Runtime Error.
can you tell me why i am getting wrong answer with this solution http://www.codechef.com/viewsolution/2372448 for the above question?
The link appears to be broken, just try printing your “a” array & cross check for small cases with pen & paper.
This is the link : http://ideone.com/LVkXtl