Answers to: cf 447 div2 Ralph And His Magic Fieldhttps://discuss.codechef.com/questions/118218/cf-447-div2-ralph-and-his-magic-field<p>i have understood the formula for it but i am unable to understand that when k=-1 and n and m have different parity the answer will be -1 but for k=1 answer will not be -1 why?
<a href="http://codeforces.com/contest/894/problem/B">problem</a></p>enFri, 24 Nov 2017 00:56:23 +0530Answer by shivam9654https://amritawintercamp15.discuss.codechef.com/questions/118218/cf-447-div2-ralph-and-his-magic-field/118432<p>if we multiply all rows's product then they should be equal to multiplication of all element in the matrix same for columns. if n and m have different parity lets say n is even and m is odd then when we multiply all row's product we get even number because each row's product is equal to -1 but when we multiply all column's product then we get odd number but both should be equal to multiplication of all elements in the matrix that's why for k=-1 if n and m have different parity then solution does not exist....</p>shivam9654Fri, 24 Nov 2017 00:56:23 +0530https://amritawintercamp15.discuss.codechef.com/questions/118218/cf-447-div2-ralph-and-his-magic-field/118432Answer by rajashekar007https://amritawintercamp15.discuss.codechef.com/questions/118218/cf-447-div2-ralph-and-his-magic-field/118220<p><a href="http://codeforces.com/blog/entry/55884?#comment-396228">This</a> comment shall answer your question.</p>rajashekar007Mon, 20 Nov 2017 23:04:57 +0530https://amritawintercamp15.discuss.codechef.com/questions/118218/cf-447-div2-ralph-and-his-magic-field/118220