Why is this giving TLE for 510A Codeforces?
Why is this giving TLE for 510A Codeforces?
Hello Aryan, first of all pls increase the size of your array as you have initialised it to char a[n][m];
and you are accessing a[n][i] or a[i][m] index. What I mean is that how this is possible to have a value of first index as n and that of second index as m. For that you need to take the array of size like a[n+1][m+1] and pls make the logic simpler. Suppose first of all you have marked the whole matrix with # then you will move on to the even rows and there if it is divisible by 4 you will make all the elements from 1 to m-1 equal to β.β else if it is divisible by 2 but not by 4 then you will make all the elements from 2 to m equal to β.β
I hope it is clear to you. In case it is clear to you pls mark it as resolve and provide the rating as well as feedback so that we can improve ourselves.
In case there is still some confusion pls let me know, I will surely try to help you out.
Thanks 
Happy Coding !!
Okay Sir But Yes, I thought of this logic too but donβt you think which one I wrote will be more simpler as in the next loops we will not have to write much code again? and that would reduce Time Complexity too.
And One More doubt Sir I usually have is like if I have initialized loop from 1 so will array also be initialized from 1 then or array will always start with 0 index and in case of mine a[0]=garbage value.
See the array will always start from index zero and suppose your array size is n then it can go from index 0 to n-1. So if you want to consider the elements from 1 to n and want to use 1 based indexing then take the array size to be 1 to n+1 and then you will be able to access the indexes from 0 to n and then ignore 0 index and you indexing from 1 to n.
Yeah your logic is also seems to be alright. Pls first of all change the size of the array and then try to run that. And ask if still you will get any error.
No Sir, Understood and got accepted by CF too. Thanks
Great Aryan !! Pls mark it as resolve and provide the rating as well as feedback so that we can improve ourselves.
Thanks 
Happy Coding !!
I hope Iβve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.