wrong answer in BITMAP spoj

Please provide some test cases where my code is wrong
Here is my code

Hello sasidhar54731

There is a similiar post where someone asked why is his code for the bitmap getting WA ?

I have analysed his code and figure out all the mistake that he was doing. All the mistakes are very general and anyone can commit such mistakes in a graph problem like this…

so i first suggest you to go through this post …

Here is the link http://discuss.codechef.com/questions/60374/spoj-bitmap-wa

if you will still be getting WA then feel free to post … i will look into your code and will surely help you solving this problem …

it may happen that this post will not solve your problem but you will definately take away something from that post … please read it once . :slight_smile:

I have not solved using BFS i solved it in a different way please give some test cases where my code is wrong

Hello sasidhar54731

Ok i have decided to look into your code and find the following thing incorrect …

s[zero[i].first][zero[i].second]=min+'0';

This statement in your code is perfectly invalid … shortest distance will be an interger which could be equal to M+N … but you are storing that in the character which is not possible …

here is one simple test case

7 7
1000000
0000000
0000000
0000000
0000000
0000000
0000000

you will surely love the output generated by your code :slight_smile:

0 1 2 3 4 5 6 
1 2 3 4 5 6 7 
2 3 4 5 6 7 8 
3 4 5 6 7 8 9 
4 5 6 7 8 9 : 
5 6 7 8 9 : ; 
6 7 8 9 : ; < 

but this approach to solve this problem will definately get
TLE on spoj …

for better approach look at the mentioned discussion …

thank you @ ma5termind

hello sasidhar54731

if you got the solution to your problem i request you to close this post by accepting the answer so that others will not waste their precious time on this post anymore :slight_smile:

How to accept the answer