A+ will be down for a version upgrade on Thursday October 17th 2024 at 09:00-12:00.
This course has already ended.

The latest instance of the course can be found at: Competitive Programming: 2024

Homework before week 8

This week we will have a closer look at the use of C++ and Python in programming contests.

Homework reading

If have not yet used C++ and/or Python in our course, please first learn enough about the basics so that you can write small programs similar to what we have seen so far in this course also in those languages.

Please read (at least) the following parts of Competitive Programmer’s Handbook to prepare for week 8:

  • Section 1.1: Programming languages

  • Section 1.2: Input and output (note std::ios::sync_with_stdio)

  • Section 1.3: Working with numbers (note long long)

  • Section 1.4: Shortening code

  • Section 3.2: Sorting in C++

  • Section 4.5: Other structures: Bitset (note std::bitset)

  • Section 10.1: Bit representation

  • Section 10.2: Bit operations (note __builtin_popcount etc.)

  • Section 10.3: Representing sets

  • Section 10.4: Bit optimizations

Then please look at the following pages for further instructions:

Finally, please familiarize yourself with one contest library, for example, this one:

Homework problems

This time there will be two mini-contest, one task in each:

In the C++ contest, you have to use C++ to solve the task, and in the Python contest, you have to use Python to solve the task. Please ask in Zulip if you need help!

To complete the homework, solve these tasks before the contest closes. Please use your own personal CSES account.

A+ presents the exercise submission form here.

Posting submission...