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

Автор tosivanmak, история, 3 месяца назад, По-английски

I came up with a quite slow solution for Educational Codeforces Round 168 Problem F at the last minute of the contest, and I was unable to implement it on time.

When I tried implementing the solution after the contest, it showed a time limit exceeded verdict on codeforces. 273604133

However, when I test the exact same code and same test on atcoder with the "Custom invocation", it shows that the code only runs in 2155 ms, which is much lower than that of the TL. Can anyone help me with this issue? Thanks.

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

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

Auto comment: topic has been updated by tosivanmak (previous revision, new revision, compare).

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

Auto comment: topic has been updated by tosivanmak (previous revision, new revision, compare).

»
3 месяца назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится

It's probably because of abuse of long long. I did some optimizations and it fits in time limit. See 273863548. The wrong answer verdict is not my issue.

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

    Will long long really slow down programs?

    It seems that many people have mentioned it. But why?

    • »
      »
      »
      3 месяца назад, # ^ |
        Проголосовать: нравится +8 Проголосовать: не нравится

      long long uses more memory which makes it slower. I am not sure if long long will affect the speed of modulo though.

      • »
        »
        »
        »
        3 месяца назад, # ^ |
          Проголосовать: нравится +19 Проголосовать: не нравится

        My solution now passes the task. I will be more careful when using long long in the future. Thanks for your help.

»
3 месяца назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

If the problem can be reproduced, perhaps CF's judger is really slower.

Perhaps you can check the processor models of CF and Atcoder.

Also, I heard that CF is Windows and Atcoder is Linux, but I'm not sure if there's a difference.

Hoping This Helps.

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

    Then I think cf is probably much slower than that of atcoder, probably need to be more careful with constants when doing cf problems in the future.