4 ms·
First of all, there are plenty of people who solved both large inputs with Python/Ruby (with and without pre-computing all the fair and square numbers).[0][1]
by wting 14y ago
First of all, there are plenty of people who solved both large inputs with Python/Ruby (with and without pre-computing all the fair and square numbers).[0][1]
As others have stated, the contests are designed such that language shouldn't matter and problem sets are deemed solvable with Python as a baseline. For this particular question, the official contest analysis goes into detail on how to reduce the solution space:
https://code.google.com/codejam/contest/2270488/dashboard#s=a&a=2 https://code.google.com/codejam/contest/2270488/dashboard#s=...
Now the issue becomes the trade off between development speed vs runtime performance.
Is it possible that you might solve the problem with a worse solution in a better performing language? Yes.
Is it possible you might finish a solution within the time constraints in a more expressive language? Yes.
If something is CPU bound in production, then going with a better performing language is a viable consideration.[2] However, my goal in programming contests is often to become a better programmer in the process. As a result, I choose to focus more on improving algorithmic complexity which is language agnostic.
[0]: http://www.go-hero.net/jam/13/solutions/0/3/Ruby http://www.go-hero.net/jam/13/solutions/0/3/Ruby
[1]: http://www.go-hero.net/jam/13/solutions/0/3/Python http://www.go-hero.net/jam/13/solutions/0/3/Python
[2]: For the pedantic, I understand that language performance is different from implementation performance.
Edit: Corrected links, thanks victorhn.
- victorhn 14y agoCorrect Link for [0] is http://www.go-hero.net/jam/13/solutions/0/3/Ruby http://www.go-hero.net/jam/13/solutions/0/3/Ruby And the most difficult version (L2) was solved by 19 contestants.