flying_monkey's blog

By flying_monkey, history, 7 months ago, In English,

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.

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
7 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
7 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
7 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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.