WA on Matrix Again[Closed]

Here is my code: http://www.codechef.com/viewsolution/5636159
getting wrong answer,tried almost all test cases.
Can’t figure out the mistake!
I bet its something very minute. :frowning:

Simplify the column sum to:

sum += (a[j][i] + 10000007) % 10000007;

and simplify the column-sum product to:

product = (product * sum) % 10000007;

still getting WA somehow…I don’t think that should make a big difference.
Both the statements mean the same things I guess?

Hey bro

Your code gives WA for this test case: http://ideone.com/HQaKb9

I run this test case on an AC’ed and got this output : 5601080 .

You may check the line by line output from AC’ed code here: http://ideone.com/gJ9uy7

Two things!

  1. I got AC,I wrote the loops in the reverse order :stuck_out_tongue:
  2. That AC code gives WA for the input you provided.
    The correct answer is 7901228.
    Here is my AC solution :
    http://www.codechef.com/viewsolution/5636413
    here one of the top AC solutions :
    http://ideone.com/TT0Ay6
    both give the same answer :slight_smile:
    I don’t know how that solution got AC with wrong answer on that test case!!

okay sorry for that, i didn’t knew about that it AC code is giving WA…

SOrry… :frowning: