Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

Блог пользователя dextrous

Автор dextrous, 9 лет назад, По-английски

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?

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

»
9 лет назад, # |
  Проголосовать: нравится +15 Проголосовать: не нравится

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 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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 лет назад, # ^ |
        Проголосовать: нравится +7 Проголосовать: не нравится

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

»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

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