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

Автор Codeforcer, история, 4 года назад, По-английски

I wanted to do a runtime analysis of B. It got AC even though I doubted it as it looked worst case O(n^2). Basically I just simulated what was asked. It is also mentioned in the editorial that simulation would take too much time. I am now really interested in the runtime of my code.

ARC-105_B

Also any ideas on D?

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

»
4 года назад, # |
Rev. 3   Проголосовать: нравится -10 Проголосовать: не нравится

Edit: For this test case: 1 2 10e9 your code will run $$$10^9$$$ loops. The test cases were so weak. In those test cases there was not any test case where $$$max\space element - min\space element > 10^5$$$ (or something more) appeared.

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

    I dont think so..as the size of the hashset remains constant for quite a time before reducing by 1. Also it doesnt explain the statement in the editorial.

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

      Ok. Try this test case: 1 2 10000000. It executes in around $$$2$$$ seconds for your code. May be the test cases were weak. My solution is also like you which will give TLE in some cases.

      My code