dextrous's blog

By dextrous, 9 years ago, In English

I tried to hack the solution http://codeforces.com/contest/548/submission/11295460 using the hack http://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?

  • Vote: I like it
  • +2
  • Vote: I do not like it

»
9 years ago, # |
  Vote: I like it +15 Vote: I do not like it

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.

  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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 ?

    • »
      »
      »
      9 years ago, # ^ |
        Vote: I like it +7 Vote: I do not like it

      You are wrong (or rather from 2003), 3-5 * 10^9 of very easy operations are possible. And branch prediction is a thing

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I dont think so! My hack had outputs correctly matching with the TL output .I am also printing 2 digits per line.