lemonade_life_input
Closed this issue · 2 comments
rjmcmcftw commented
I think you are losing some performance here using (a-b)**2 rather than writing (a-b)*(a-b)
https://github.com/kamyu104/MetaHackerCup-2022/blob/main/Round%201/lemonade_life.py3#L53
Also, I'm curious, what was your runtime on your local computer? I ran your code in pypy and it finished in 6 minutes and 30 seconds.
rjmcmcftw commented
Also here you should precalculate D**2.
https://github.com/kamyu104/MetaHackerCup-2022/blob/main/Round%201/lemonade_life.py3#L54
kamyu104 commented
- I don't optimize it since it didn't help on my local computer.
- I ran my code in PyPy v7.3.7 and finished in 273.23s (~4.7 minutes) on Macbook Pro (2GHz, 4Cores, Intel Core i5).