I tried to hack the solution http://mirror.codeforces.com/contest/548/submission/11295460 using the hack http://mirror.codeforces.com/contest/548/hacks/155602/test but it was unsuccesful .
I am unable to understand that despite being a O(n*m*q) solution, how the solution passed the hack but eventually got TLE on a system test?
My guess is that since your case was all zeroes, the code ran fast because of branch prediction, while the system test had random data.
TLE is a matter of number of iterations or operations involved while running the code.
So what if it's all 0 or randomly 0 and 1, the code has to complete the n*m*q (500*500*5000 = 1.25 * 10^9) operations which should give a TLE!
Correct me if I am wrong, but isn't no of operations executed in 1 second are roughly of the order of 10^7 and not 10^9 ?
You are wrong (or rather from 2003), 3-5 * 10^9 of very easy operations are possible. And branch prediction is a thing
okay. thanks for correcting me.
Also if I understand correctly on your test ouptput is 1 digit per line while the test which gives TL output is 2 digits per line
I dont think so! My hack had outputs correctly matching with the TL output .I am also printing 2 digits per line.