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 you have not yet used both C++ and Python in our course, first learn enough of the basics to write small programs in each language, similar to those we have seen so far in this course.

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 a contest library. One option is:

Homework problems

This time there will be two mini-contests, each containing one task:

  • a C++ contest

  • a Python contest

Use C++ to solve the task in the C++ contest and Python to solve the task in the Python contest. Please ask the course staff if you need help!

Use the separate pre-created CSES homework accounts assigned to you: aalto26hh_NNN for C++ and aalto26hh2_NNN for Python. You will receive both sets of account credentials at a course meeting; do not use a personal CSES account. Complete both contests to earn credit for this homework week.

The homework consists of two contests:

Once you have completed the homework, submit the following form and select the pre-created CSES accounts for C++ and Python assigned to you:

A+ presents the exercise submission form here.

Posting submission...