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

Автор flying_monkey, история, 5 лет назад, По-английски

Just started using Codeforces. Wrote solution for this problem: (231A Team)https://codeforces.com/problemset/problem/231/A It gave me execution time 218ms in Python 3. I was curious how others made it 46ms when my solution is not that much different. So, to test I copied and pasted the best solution written in Python3 and I still got 218ms when they got 46ms. Why is this happening? Is this difference in execution time (in)significant? Thank you.

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

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

The default Windows tick rate, i.e. time precision, is 15 ms. The execution time may not be precise enough to measure the difference.

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

I do agree that something is strange. Even the first input case

1
1 0 0

is reported to take around 200 ms (which it really shouldn't take). Just trying this case in custom test takes much less time (your code is reported to run in 78 ms). So I don't think that your python3 code is actually any slower than other python3 solutions. Also the super quick running times 46 ms — 76 ms in python3 are all solutions from 2013, and I think that much of codeforces has changed since back then.