Factors to Consider When Choosing a Language

Author: Benjamin Qi

Reasons why choice of language matters significantly outside of USACO Bronze.

What Are The Differences Between C++11 and C++17 (or Python 2 and Python 3)?

If you're just starting out, you probably won't be using any C++17-specific features, so submitting in either language will suffice. For information about the features introduced in C++11, C++14, and C++17, check the links below.

As the link below mentions, there are many differences between Python 2 and 3. Python 3 is newer and an overwhelming majority of USACO contestants use it over Python 2.

Can I Pass Every Problem in Every Language?

tl;dr no

  • It is guaranteed to be able to receive full credit on all Bronze contests with Python, C++, and Java.
  • It is almost always possible to receive full credit on Silver contests with Python, though there are exceptions.
  • It is almost always possible to receive full credit on Silver, Gold, and Platinum contests with Java, though there are exceptions.
  • Python lacks a data structure that keeps its keys in sorted order (the equivalent of set in C++), which is required for some silver problems.
  • Java lacks features such as macros, type aliases, and auto that are present in C++ (which some contestants rely on extensively).

Time Limit

Although both Python and Java receive two times the C++ time limit in USACO, this is not the case for most other websites (ex. CodeForces, CSES). Even with the extended time limits, Python and Java sometimes have trouble passing.

Rewriting the C++ solution for USACO Silver Wormsort in Python receives TLE (Time Limit Exceeded) on 2/10 cases.

Python3 8/10 Solution

A similar solution in Java requires almost 3s, which is fairly close to the time limit of 4s.

Java Solution

A comparable C++ solution runs in less than 700ms.

C++ Solution

It's possible to pass using DSU, although this is not a Silver topic.

Python DSU

Module Progress:

Join the USACO Forum!

Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!