15-295: Competition Programming and Problem Solving, Fall 2019

In this course you will learn the techniques and skills needed to solve algorithmic programming contests problems such as those that appear on the ACM ICPC, Codeforces, and Topcoder. Most of your time will be spent writing programs on your own to solve problems.

Some students may go on to participate in the ACM ECNA regional event (which occurs in the fall -- see the section at the end of this page to learn how to be on a team) and possibly even the World Finals (which occurs in the spring).

But the skills you will pick up from the course are far more valuable than just enabling you to win contests. Many of the algorithms and techniques are classic ones that every computer scientist should know. You will also learn to think about algorithms in a deeper way, because many of the problems require you have to devise a new algorithm, not just apply a classic one. These skills will be of great value in your other classes, in your job interviews, and in your future work.

Basic Information

Class Meetings: Wednesdays from 6:30-9:00pm, GHC 4307
Instructor: Danny Sleator <sleator@cs.cmu.edu>, Office: Gates 8113, Phone: 412-268-7563
Teaching Assistant: Daniel Anderson <dlanders@cs.cmu.edu>, Office: Gates 7001
Google 15-295 Group: http://groups.google.com/group/15-295 (Required)
Codeforces 15-295 Group: http://codeforces.com/group/KIrM1Owd8u/contests (Required)
Name List: Put your names here (Required)
Grade Spreadsheet: Tabulation of Scores

For more information on how to join these groups, etc, see the Logistics section below.

Weekly Problem Sets

Most problem sets will have a theme announced in advance, along with links so you can learn about the material before class if you want. We will often give a "mini-lecture" in the classroom from 6 to 6:30, before the contest starts. The mini-lecture will cover the theme topic for the contest, and be announced via email in advance. If you are new to competitive programming, you are encouraged to attend these lectures.

The weekly contests will take place on Codeforces. They are classified under a "Codeforces Group" called 15-295. Click on this link to see a list of contests for this course and to participate in it.

The point values of the problems for each weekly contest are tabulated below, along with a solutions page which is based on contributions from students and staff in the class.

Week #01: August 28

Theme: None
Point values: 0.5, 0.5, 0.5, 1, 1, 2
Contest: Link Problems Solutions
Resources: Competitive Programmer's Handbook

Week #02: September 4

Theme: Binary Search
Point values: 1, 1, 1, 1, 2, 3
Contest: Link Problems Solutions

Week #03: September 11

Theme: Dynamic Programming
Point values: 0.5, 1, 1, 2, 2, 2, 2
Contest: Link Problems Solutions
Resources: 451 Notes

Week #04: September 18

Theme: None (Selection Round 1)
Point values: 1.5, 2, 3, 2, 1, 1
Contest: Link Problems Solutions

Week #05: September 25

Theme: None (Selection Round 2)
Point values: 2, 0.5, 1, 1, 2, 1
Contest: Link Problems Solutions

Week #06: October 02

Theme: Shortest Paths
Point values: 1, 1, 1.5, 2, 2, 2, 2.5
Contest: Link Problems Solutions

Week #07: October 09

Theme: Network Flow
Point values: 1, 1, 1, 1, 2, 3
Contest: Link Problems Solutions

Week #08: October 16

Theme: Computational Geometry
Point values: 0.5, 0.5, 1, 2, 2, 2
Contest: Link Problems Solutions

Week #09: October 23

Theme: Prime numbers and factoring
Point values: 1, 1, 1, 1, 2, 2
Contest: Link Problems Solutions

Week #10: October 30

Theme: Combinatorics and Counting
Point values: 0.5, 1, 1.5, 2, 2.5, 2.5
Contest: Link Problems Solutions

Week #11: November 6

Theme: Strings
Point values: 1, 1, 1, 2, 2, 1
Contest: Link Problems Solutions
Resources: (Notes on Karp-Rabin Fingerprinting)

Week #12: November 13

Theme: Games
Point values: 1, 1.5, 2, 1, 1.5, 2
Contest: Link Problems Solutions
Resources: Impartial Games (i.e. Nim-like games), Sums of Games

Week #13: November 20

Theme: Segment Trees
Point values: 1, 1.5, 2, 2, 2
Contest: Link Problems Solutions
Resources: Notes on SegTrees and Fenwick Trees

Week #14: December 4

Theme: None
Point values: 1, 1, 1, 1, 1, 1, 1
Contest: Link Problems Solutions

Grading

This course is 5 units. Each week you will be given several problems to try to solve during class. You will be allowed (for half credit) to solve these problems during the week after the contest ends. You can also get credit for solving problems during rated contests on Codeforces. (This site run rated contests approximately every two weeks.)

Let me be more specific. Each problem that we give has some number of points between 0.5 and 3. Let X be the total number of points of the problems you solve in class. Let X' be the total number points of the problems you solve in the week after class. Let Y be the number of Codeforces problems you solve. (Y only counts problems B, C, etc. (NOT A, they're too easy, and not Div 3) solved during rated contests. Virtual contests are not rated.) Your score in the course is X + X'/2 + Y.

Here is how your grade is determined:

score ≥ 25: A
score ≥ 15: B
score ≥ 10: C
score ≥   5: D

Rules

You can make use of generic on-line resources while solving problems. These include things like language documentation, API documentation, algorithm descriptions, terminology, etc. You should not search for or make use of code written by others to solve the specific assigned problem.

If you're stuck on a problem, you are welcome to discuss it with another student in the class, or the course staff. Keep the level down so as not to disturb those around you.

During the selection rounds (see below), discussion with classmates is not allowed. Clarifications can be obtained from the course staff.

Logistics

Resources

In case you're unfamiliar with how to deal with standard input and standard output, here is a link to a document showing the solution to a problem in several different languages.

The Competitive Programmer's Handbook by Antti Laaksonen covers (perhaps somewhat superficially) many topics that come up in competitive programming.

Last semester's course has links to the topics for each of those contests, as well as solutions to many of the problems.

A way to get started and to improve is via the USACO training site. They've developed a series of lessons along with corresponding problems. It will take you from a beginner to a strong contest programmer.

There are a number of excellent tutorials on the algorithms and techniques needed to solve these kinds of contest programs on Topcoder's Data Science Tutorials web site.

You can also do old problems on codeforces. Just go to codeforces.com/contests and click "enter" on any of the contests. You can then try solving problems. You can also go to the scoreboard of the contest and click on other people's solutions to see their code. This is a great way to learn.

Feel free to contact (email or stop by) the instructor or the TA any time to discuss problems, including during class.

Here are a few tutorials about important algorithms:

Geometric Primitives and Convex Hull.
A segment tree implementation and tutorial.
Range Trees (AKA Fenwick Trees)
Lecture Notes about min cost flow, along with an implementaiton.
Union-Find Lecture Notes.
Link-Cut Trees (See detailed comments in this codeforces submission.)
Long Blog Post on Graph Algorithms

TODO: Add to this list

Being on an ACM ICPC Team

We typically send five teams of three to the ACM ECNA regional event. This year it will take place on Saturday October 26. We drive to Youngstown on Friday afternoon, stay in a hotel, do the contest on Saturday, and return in the early evening on Saturday night.

The teams will be selected based on the results of two contests which will take place during regular class times on September 18th and 25th. I am only considering undergraduate students or masters students who are eligible to go to the World Finals (you can't go to the world finals more than two times). The World Finals will take place in the spring of 2020 in Moscow, Russia. If you are interested in trying to be on a team, it is imperitive that you participate and do well in the two selection rounds on September 18th and 25th.


Danny Sleator
Last modified: Fri Dec 6 1:33:12 2019