Successfully reported this slideshow.
Upcoming SlideShare
×

# Python in programming competitions

483 views

Published on

Slides from the lightning talk "Python in programming competitions" by Sergey Dymchenko, December 10, 2014 at PuPy (Puget Sound Python meetup group).

Published in: Technology
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

### Python in programming competitions

1. 1. Python in programming competitions Sergey Dymchenko http://sdymchenko.com December 10, 2014 Sergey Dymchenko (http://sdymchenko.com) Python in programming competitions December 10, 2014 1 / 9
2. 2. Why participate? fun programming skills job opportunities interview preparation prizes ... Sergey Dymchenko (http://sdymchenko.com) Python in programming competitions December 10, 2014 2 / 9
3. 3. Contests with explicit Python support - 1 Code runs on the contest server. Python 2.7 and Python 3. Usually only standard library can be used. Usually no guarantee that time limit is large enough for Python. Sergey Dymchenko (http://sdymchenko.com) Python in programming competitions December 10, 2014 3 / 9
4. 4. Contests with explicit Python support - 2 Some useful Python features: long integer arithmetic modular exponentiation (3rd argument of pow) regular expressions fractions (rational number arithmetic) Sergey Dymchenko (http://sdymchenko.com) Python in programming competitions December 10, 2014 4 / 9
5. 5. Contests with explicit Python support - 3 TopCoder - http://www.topcoder.com/ Codeforces - http://codeforces.com/ Codechef - http://www.codechef.com/ Sergey Dymchenko (http://sdymchenko.com) Python in programming competitions December 10, 2014 5 / 9
6. 6. Contests with explicit Python support - 4 Problem (http://codeforces.com/problemset/problem/456/B):
7. 7. nd (1n + 2n + 3n + 4n) mod 5, where 0 n 10105 . n = int(raw_input()) result = (pow(1, n, 5) + pow(2, n, 5) + pow(3, n, 5) + pow(4, n, 5)) % 5 print result Sergey Dymchenko (http://sdymchenko.com) Python in programming competitions December 10, 2014 6 / 9
8. 8. Language-agnostic contests - 1 Code runs on a participant's computer. Any Python versions, libraries, bindings, interfaces, etc. Prepocessing, testing, scripting, etc. Sergey Dymchenko (http://sdymchenko.com) Python in programming competitions December 10, 2014 7 / 9
9. 9. Language-agnostic contests - 2 Some useful tools: Sage - http://www.sagemath.org/ graph-tool - http://graph-tool.skewed.de/ Google OR tools - https://code.google.com/p/or-tools/ Sergey Dymchenko (http://sdymchenko.com) Python in programming competitions December 10, 2014 8 / 9
10. 10. Language-agnostic contests - 3 Google Code Jam - https://code.google.com/codejam Facebook Hacker Cup - https://www.facebook.com/hackercup IPSC - http://ipsc.ksp.sk/ ICFPC - http://icfpcontest.org/ Challenge24 - http://ch24.org/ Sergey Dymchenko (http://sdymchenko.com) Python in programming competitions December 10, 2014 9 / 9