Hi, anyone has the python solution for USACO 2017 US Open Contest, Silver Problem 2. Bovine Genomics
http://www.usaco.org/index.php?page=viewproblem2&cpid=739
My solution pass all tests except 7 and 10 because of execution timeout. I cannot find any python solution from the internet, it will be great if someone can post the final solution.
Thanks
1 Like
yeah me too, my code passes all except for 10 (time limit)
Python might be too slow for that problem given the large constant factor. I highly recommend switching to another language like Java and C++.
I figured it out! (with the help of a friend)
It turns out that global variables take longer to access than local variables, so if your issue was the same as mine, putting your entire code into a function and then calling it should cut down on time.
Nice! However, for many other USACO problems, Python code (even when put in a function) will TLE on some test cases.