Click here to Skip to main content
15,792,381 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Contest Page | CodeChef[^]

What I have tried:

int main()
    int i,j,T;
    int c1[20],c2[20];
    char s[20][100000];



            else if(s[i][j]=='B')
            else if(s[i][j]=='.') 
                else if (s[i][j+1]=='B'&&s[i][j-1]=='B')

        printf("%d %d\n",c1[i],c2[i]);
Updated 13-Nov-17 10:41am
Richard MacCutchan 13-Nov-17 9:35am    
If you want help then you need to explain what the code is supposed to do and where it is failing.
Patrice T 13-Nov-17 15:09pm    

This is a repost, the only changes done are the corrections you have been given in first question.
I seriously donno HOW to IMPROVE THIS FURTHER[^]

As you have already been told, use the debugger to see what your code is doing.

Your code fail because your algorithm is wrong.
As programmer, your job is to create algorithms that solve specific problems and you can't rely on someone else to eternally do it for you, so there is a time where you will have to learn how to. And the sooner, the better.
Share this answer
They are telling you why with the result indicator which is a red X in your case:
Wrong Answer
Your program compiled and ran succesfully but the output did not match the expected output.
Share this answer
ahmedarifhasan 13-Nov-17 9:46am    
yup, i got that brother, but my doubt is,Why isn't it accepting, i mean there must be some error which i am unable to identify, so i want you to help me with finding this error, and how can this code be made correct.
Dave Kreskowiak 13-Nov-17 10:42am    
That's what the debugger is for. Step through the code to make sure your algorithm is doing what you think it is. The debugger is there to debug YOU, to help you understand what the code is really doing instead of what you assume it's doing.
Jochen Arndt 13-Nov-17 10:58am    
Why: Your program just did not print the expected result.
Error: Your algorithm / implemention is not correct.

What does it print for the example provided by the challenge?

So you have to debug as suggested by Dave or rethink about your algorithm.

"but the contest is over, and i want to know where i'm going wrong"
Then have a look at the other solutions.

Hint 1 (I had a look on some):
You are processing the T tasks in a different manner than many other solutions. That introduces a problem not observed in your code (there may be more but one is obvious by just reading the code).

Hint 2:
If there are not more errors (I have not run the code) I would expect the first task to be correct.
It's not being accepted probably because the expected output isn't being produced.

If you were looking for someone to debug your code for you, that's not going to happen as you wouldn't learn anything.
Share this answer
ahmedarifhasan 13-Nov-17 9:25am    
but the contest is over, and i want to know where i'm going wrong.Hope you understand.
ahmedarifhasan 14-Nov-17 11:34am    
all i want to say now is:
"sadly, i expected help!"
Dave Kreskowiak 14-Nov-17 12:16pm    
I already told you. That's what the debugger is for. Step through the code, line by line, so you can see what your algorithm is doing and where it is going wrong.

Having someone do this for you doesn't teach you anything. If you're going to continue to write code, this is a skill YOU MUST LEARN. If you don't, you have no hope of debugging your algorithm and seeing where you're going wrong.
ahmedarifhasan 15-Nov-17 8:21am    
thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900