What is Competitive Programming?

August 12, 2022

30 minutes

What is Competitive Programming?

Competitive programming is a mind sport where you'll be given some set of algorithmic challenges and a fairly short amount of time to submit code that produces an exact solution. In this way it's not dissimilar to math competitions, though they are a bit more expansive since you can do more with a computer

How to improve?

Unfortunately, there is no real shortcut. It is not a quick or easy process, the only way to get better is to practice. 'Practice' means solving problems, spending time working through problems and learning how to break down a problem to its core and logically think of the next steps. While it is still important to study theory, practicing problem solving skills should be your main focus.

It's also important to reflect on your time spent when you finish working on a problem.

  • How did you arrive at the solution?
  • What made you realize something would or wouldn't work?
  • If something didn't work why did you not realize the idea didn't work earlier?
  • Was this problem too easy?

To draw an analogy, lifting 100 pound weights 500 times won't help you do the 150 pound weights at all. It only makes you better at 100 pound weights, likewise doing easy problems only makes you better at easy problems

If you didn't finish a problem, can't solve it, or are just exhausted

  • Was this problem too hard? (have no ideas)
  • Was there some data structure or optimization you don't know how to make? (insufficient knowledge)

Again, these aren't easy questions to answer. The process isn't easy and it never will be (it's part of the reason so many of us enjoy it so much), the process of getting better is never ending. If you're ever feeling drained or feel like you stop having fun, it's ok to take breaks. Burnout is a real thing so make sure to take your mental health seriously too :P

Beginner Resources

As a beginner, the most important thing you can do to make the learning experience smoother is to a programming background. Ideally this would be in only C++, java, or python, but only need the basics to actually begin competitive programming. If you're profficient in another language, take some time to learn the basics of one of these (prefer C++).

https://darrenyao.com/ https://train.usaco.org/usacogate https://usaco.guide/ https://cses.fi/book.pdf http://usaco.org/index.php?page=contests

Intermediate Resources

By this point you're likely pretty comfortable with a programming language and also used to solving problems. The range of topics in your ability you may encounter is still not so wide and its important to continue practicing problem solving. Most prefer codeforces and atcoder the most, but to each their own. What really matters is that you are doing hard problems

http://cp-algorithms.com/ (a list of algorithms & data structures to refer to) https://oi-wiki.org/ (in chinese)

Advanced Resources

By this point you likely don't need anyone to give you direction on where and how to practice, or what to study. At this point, some things to consider are to start picking up college texts in math and/or algorithms and beginning to work through these. Likely the ones that are most applicable will be combinatorics or algorithms textbooks. If there's a specific topic related to competitive programming you're interested in usually googling "topic" + codeforces is enough to find something. Check resources as well. You may also be at the point of reading research papers by well known CS figures and keeping up with modern CS research.

(some personal recommendations for undergrads or advanced high schoolers to get started with higher level math) Algorithms: CLRS Lin Alg : Axler Game Theory: ONAG or Winning Ways Combo: A course in enumeration Discete Math Intro: Discrete Math with Ducks

USACO / Problem Trackers

These are meant to be organizational tools to help you track which (olympiad) problems you have or have not solved yet https://codeforces.com/blog/entry/78158 https://bit.ly/usaco-tracker http://oichecklist.pythonanywhere.com/ (includes other international olympiads) https://codetiger.me/project/usaco (estimates of problem difficulties based on users & tracker)

Contests & Sites There are several national olympiads similar to USACO. You can google around a bit (try to include 'olympiad' or 'informatics' in your search queries). IOI, APIO, CEOI, COCI, JOI are some examples of national/international olympiads. Other than the nationally hosted olympiads (such as USACO), there are several other platforms & companies that host programming competitions. Some of the most popular being https://codeforces.com/ https://atcoder.jp/ https://www.codechef.com/ https://codingcompetitions.withgoogle.com https://www.topcoder.com/thrive/tracks?track=Competitive%20Programming

Standard Problem Sets 'Standard' doesn't necessarily mean easy. It means a problem is well studied and has had a known solution for some time now. Often in competitive programming you may find that a problem is very similar to one of these standard problems that you know a solution for or have coded before. To be a stronger competitor, you will at some point be expected to know these concepts instantly and be comfortable coding them. https://codeforces.com/edu/courses https://cses.fi/problemset/ https://judge.yosupo.jp/ https://csacademy.com/contest/archive

Resources

Contest Sites: AtCoder: https://atcoder.jp/ Codeforces: https://codeforces.com/ CodeChef: https://www.codechef.com/ DMOJ: https://dmoj.ca/ Facebook Hacker Cup: https://www.facebook.com/codingcompetitions/hacker-cup/ Google Code Jam, Kick Start: https://codingcompetitions.withgoogle.com/ Topcoder: https://www.topcoder.com/community/competitive-programming/

Books:

CP Handbook: https://cses.fi/book.pdf CP3: https://github.com/prasadgujar/CompetitiveProgramming/blob/master/book/Competitive%20Programming%203.pdf, http://libgen.is/book/index.php?md5=F6F195012783A8B3C8BB7628882A51B7 Principles of Algorithmic Problem Solving: http://www.csc.kth.se/~jsannemo/slask/main.pdf The Hitchhiker's Guide to the Programming Contests: https://comscigate.com/Books/contests/icpc.pdf

Bronze/Silver USACO Books by Darren Yao

Java: http://darrenyao.com/usacobook/java.pdf C++: http://darrenyao.com/usacobook/cpp.pdf

Guide to DP: https://dp-book.com/Dynamic_Programming.pdf Crash Course Coding Companion: https://www.dropbox.com/s/z2lur71042pjaet/guide.pdf?dl=0 Mostafa Public Problem Lists: https://docs.google.com/spreadsheets/d/1-n9Fnvhsnvsqh-IerE_yyIshw5RUNer_7EjwF_GW-TA/ Junior Training Sheet: https://docs.google.com/spreadsheets/d/1iJZWP2nS_OB3kCTjq8L6TrJJ4o-5lhxDOyTaocSYc-k/ OI Checklist: http://oichecklist.pythonanywhere.com/ USACO Checklist: https://docs.google.com/spreadsheets/d/1z2k-fv6q9KPHDuZu1arBvwIuKZ4HCoBRfHQR0UryPMQ/edit?usp=sharing USACO FAQ: https://darrenyao.com/usacofaq/ USACO Guide: https://usaco.guide/ USACO Tracker Spreadsheets: https://codeforces.com/blog/entry/78158 USACO Unofficial Syllabus: https://www.overleaf.com/read/fktckfprxyxn Note that the above syllabus does not guarantee that future problems will only use the mentioned topics, it is only based on past problems.

USACO Practice Method Guide: https://www.reddit.com/r/usaco/comments/pk3tjp/the_ultimate_usaco_practice_method/

Algorithm Resources:

Aeren's Template: https://github.com/FlowerOfSorrow/Template Algorithms Visualized: https://visualgo.net/ Atcoder Library: https://img.atcoder.jp/practice2/ac-library.zip Codeforces EDU: https://codeforces.com/edu/courses CP Algorithms: http://cp-algorithms.com/ IOI Syllabus: https://ioinformatics.org/page/syllabus/12 (topics not on here can appear on Platinum as well) KACTL: https://github.com/kth-competitive-programming/kactl Library Checker: https://judge.yosupo.jp/ User-made ICPC Syllabus: https://docs.google.com/document/d/1_dc3Ifg7Gg1LxhiqMMmE9UbTsXpdRiYh4pKILYG2eA4/edit

Contest Calendar: https://clist.by/ (includes non-CP competitions as well)

Olympiad in Informatics: AIO, FARIO: https://orac.amt.edu.au/cgi-bin/train/hub.pl AIPO: https://www.acmicpc.net/category/356 APIO: https://oj.uz/problems/source/26 BkOI: https://oj.uz/problems/source/111 BOI: https://cses.fi/boi/list/ CEOI: https://cses.fi/ceoi/list/ CCC: https://dmoj.ca/problems/?category=4 CCO: https://dmoj.ca/problems/?category=24 COCI: https://oj.uz/problems/source/122, https://dmoj.ca/problems/?category=13 COI: https://oj.uz/problems/source/221, https://www.acmicpc.net/category/25 EJOI: https://www.acmicpc.net/category/424 EOI: https://codeforces.com/group/swEqtABRxe/join Infoarena (includes RMI): https://infoarena.ro/ infO(1) Cup: https://oj.uz/problems/source/319 INOI: https://www.codechef.com/INOIPRAC IZhO: https://oj.uz/problems/source/24 IOI: https://oj.uz/problems/source/22 JOI: https://oj.uz/problems/source/45 LOI: https://www.acmicpc.net/category/198 MCO: https://ioimalaysia.org/resource/for-student/practice/ NOI: https://www.acmicpc.net/category/425, https://cses.fi/241/list/ NOI.PH: https://noi.ph/past-problems/, https://codeforces.com/group/Sw3sdIlMPV/join NOI-CN: https://dmoj.ca/problems/?category=40 NOI-SG: https://oj.uz/problems/source/151 NZIC: https://train.nzoi.org.nz/contests/past OBI: https://olimpiada.ic.unicamp.br/ OMI: https://www.olimpiadadeinformatica.org.mx/OMI/OMI/Problemas/Problemas_2017.aspx Old USACO Contests: https://www.acmicpc.net/category/106 POI: https://szkopul.edu.pl/task_archive/oi/ RMI: https://oj.uz/problems/source/448, on infoarena for older SACO: https://saco-evaluator.org.za/cms/ TOKI: https://tlx.toki.id/ UOI: https://contests.oi.in.ua/ USACO: http://usaco.org/index.php?page=contests VNOI: https://oj.vnoi.info/ ZCO: https://www.codechef.com/ZCOPRAC Other Online Judges: CS Academy: https://csacademy.com/about/ CSES: https://cses.fi/problemset/ Kattis: https://open.kattis.com/ POJ: http://poj.org/ SPOJ: https://www.spoj.com/ Timus: https://acm.timus.ru/?locale=en UVa: https://onlinejudge.org/

Useful Articles (dm if you want to add one or post in suggestions):

Article Collections/Blogs: A Simple Blog: https://robert1003.github.io/ Awesome CP: https://github.com/lnishan/awesome-competitive-programming Bits and Bytes: https://bits-and-bytes.me/ Codeforces Blogs Catalog: https://codeforces.com/catalog DP Tutorial and Problem List: https://codeforces.com/blog/entry/67679 Errichto Learning Resources: https://github.com/Errichto/youtube/wiki/Learning-resources Informatics Notes: https://sendtoaryansh.gitbook.io/informatics-notes/ List of Some Useful CF Blogs: https://codeforces.com/blog/entry/13529 Resources Google Drive: https://drive.google.com/drive/folders/15LY8QFBXrshY1YqB8nQdhLVaL1E9_mMy?usp=sharing TJ SCT: https://activities.tjhsst.edu/sct/ The Ultimate Topic List: https://codeforces.com/blog/entry/95106

Specific Articles:

Alien's Trick: http://www.serbanology.com/article/The%20Trick%20From%20Aliens Bitwise Operators: https://codeforces.com/blog/entry/73490 Bitwise Operators Part 2 (Bitsets): https://codeforces.com/blog/entry/73558 C++ Comparator: https://codeforces.com/blog/entry/72525 Cache Friendliness: https://codeforces.com/blog/entry/69685 Centroid Decomposition: https://medium.com/carpanese/an-illustrated-introduction-to-centroid-decomposition-8c1989d53308 Convex Hull Trick: https://codeforces.com/blog/entry/63823 CSES Math Tutorial: https://codeforces.com/blog/entry/82103 DFS Tree + Applications: https://codeforces.com/blog/entry/68138 DP Tricks: https://codeforces.com/blog/entry/47764 DP Optimizations: https://codeforces.com/blog/entry/821 Easy HLD Implementation: https://codeforces.com/blog/entry/53170 GCC Compilation Flags for Debugging: https://codeforces.com/blog/entry/15547 Generating Functions: https://codeforces.com/blog/entry/77468 Half-Plane Intersection: https://codeforces.com/blog/entry/61710 Iterative Segtree: https://codeforces.com/blog/entry/18051 K-d Tree: https://codeforces.com/blog/entry/54080 Kinetic Tournament Tree: https://codeforces.com/blog/entry/82094 LCT Subtree Info: https://codeforces.com/blog/entry/67637 Line Tree: https://codeforces.com/blog/entry/71568?#comment-559304 log(N) BIT Binary Search: https://codeforces.com/blog/entry/61364 Nim and Grundy Numbers: https://codeforces.com/blog/entry/66040 Parallel Binary Search: https://codeforces.com/blog/entry/45578 Principle of Inclusion-Exclusion: https://codeforces.com/blog/entry/64625 Range Query Intro: https://codeforces.com/blog/entry/79202 Segtree Beats: https://codeforces.com/blog/entry/57319 SOS DP: https://codeforces.com/blog/entry/45223 Splay Tree: https://codeforces.com/blog/entry/79524 Undo on DS: https://codeforces.com/blog/entry/83467 unordered_map custom hash: https://codeforces.com/blog/entry/62393 unordered_map tips: https://codeforces.com/blog/entry/21853 XOR Basis: https://codeforces.com/blog/entry/68953 XOR Techniques: https://codeforces.com/blog/entry/68953 fishy15 — 12/11/2020 Useful Websites (dm if you want to add one or post in suggestions): acmX: https://marketplace.visualstudio.com/items?itemName=marx24.acmx Carrot Rating Predictor: https://github.com/meooow25/carrot Codeforces CLI Tool: https://codeforces.com/blog/entry/66552 Codeforces Line Numbers: https://greasyfork.org/en/scripts/403747-cf-linemaster Codeforces Performance: https://greasyfork.org/en/scripts/402180-codeforces-performance Fortune's Algorithm Visualized: https://www.desmos.com/calculator/ejatebvup4 Codeforces Visualizer: https://cfviz.netlify.app/index.html Graph Editor: https://csacademy.com/app/graph_editor/ Kenkoooo: https://kenkoooo.com/atcoder#/table/ (has AtCoder problem difficulties) Online Whiteboard: https://cjquines.com/qboard StopStalk: https://www.stopstalk.com/ fishy15 — 01/02/2021 Youtube Channels: Algorithms Conquered: https://www.youtube.com/channel/UCVp5MlM5aQbhObh5JYlgHUw Algorithms Live!: https://www.youtube.com/channel/UCBLr7ISa_YDy5qeATupf26w benritmicocode: https://www.youtube.com/channel/UCSQmpb_K_I37JN-QLArZbFw Codeforces With Java: https://www.youtube.com/channel/UCJtyODN6zjWnl4lwLHwfdcw Colin Galen: https://www.youtube.com/channel/UCpvS3EykHW--l0ogUhMEjEw Dardev: https://www.youtube.com/channel/UC0PYAh68WLY69tMXCzPKpLA Errichto: https://www.youtube.com/channel/UCBr_Fu6q9iHYQCh13jmpbrg Jonathan Paulson: https://www.youtube.com/channel/UCuWLIm0l4sDpEe28t41WITA luis enrique vargas azcona: https://www.youtube.com/user/luisoncpp LeeBros Code (in Korean): https://www.youtube.com/channel/UCe14db9xzTx8DNPUPxNKO9g MIT OCW: https://www.youtube.com/c/mitocw/ Niema Moshiri: https://www.youtube.com/channel/UC05LugecRCvKLip8Tqz2krA SecondThread: https://www.youtube.com/channel/UCXbCohpE9IoVQUD2Ifg1d1g Stable Sort: https://www.youtube.com/channel/UCV2g02zq5y7unJ_GSr-de2w Stefan Dascalescu: https://www.youtube.com/channel/UCyTPeByJ_FvAJljtc0svt-Q VPLanet: https://www.youtube.com/channel/UCdNNY8Y8meG3z9Wy6MTzcLg William Lin: https://www.youtube.com/channel/UCKuDLsO0Wwef53qdHPjbU2Q WilliamFiset: https://www.youtube.com/user/purpongie

Note: underline means that this resource is generally high quality and good for beginners

Misc

All Good CP tutorials C++ Manifesto Geeksforgeeks algorithm list vectors Algorithms https://ncduy0303.github.io/Competitive-Programming/ Others: https://ai.google/education/ Google Kickstart / Code Jam Rust Book Algorithms Errichto Help FAQ