# How to prepare for ACM – ICPC?

ACM ICPC(**A**ssociation for **C**omputing **M**achinery – **I**nternational **C**ollegiate **P**rogramming **C**ontest) is a world-wide annual multi-tiered programming contest being organized for over thirteen years. The contest is sponsored by IBM.

This article focuses on what all topics that are important for the competitive programming and should especially be studied in order to train yourself for upcoming ACM-ICPC contest.

**Rules of the Contest** – World final Rules for 2017 Click here

**Indian Participants** – Codechef conducts all the Indian Regionals. Click here to know about team formation, reimbursements etc

**ICPC for Schools** **by CodeChef** – This competition serves as a gateway for the school students to participate in ACM ICPC contest along with ICPC college participants held across India. It is an idea conceived by CodeChef and supported by Amrita University.

**A sample ICPC Problem : **A usual ICPC problem has the following features:

**Problem statement:**describing the problem and what output is to be generated.**Input:**Make sure that you read this section with complete attention as missing out any minor detail may land you in wrong answer zone.**Output:**Just like above, this one also should be read carefully.**Constraints:**These can include constraints on input, time, memory, code size, etc.**Time limit:**See if your algorithm can work in this range. If not, time to change it!**Memory limit:**If you are fond of allocating memory for every small thing, it’s a good time that you changed it.

**Preparing for ACM-ICPC**

**First and foremost Step:** **PRACTICE – **Following are the resources that can be referred for practicing the ACM-ICPC alike contests and problems. For all these OJs, begin with the problems with maximum submissions and check other solutions to check how you may improve. Do Participate in their monthly contests to remain up to the mark.

- ACM-ICPC Past Problems – ICPC Archive, Practice at Codechef
- TopCoder – Proceed by increasing problem levels gradually
- Codeforces -List of Problem Sets
- Codechef – Beginers can start with Codechef Beginners and proceed further
- SPOJ – Move from easy to tough problems
- USACO – Excellent training resource
- uvaOnline Judge – Huge repositry of problems
- Hackerrank – Practice problems topic wise and participate in preparatory series
- Hackerearth – Participate in preparatory series
- Practice – Good for beginners. Has problems ranging from difficulty level School to Hard.
- List of various Competitive Programming Contests available online all through the year

**What to study?**

Knowing just the basics of programming won’t be fruitful for aspirants of ACM ICPC. One needs to have a thorough knowledge of advanced algorithms used as well. Following Topics list out the necessary Topics and Algorithms that one must surely know to improve and stand a chance in the actual competition.

**Elementary data structures: ** To begin with competitive programming, one must master the Data Structures. Following is the list of most commonly used data structures:

**Advanced Data Structures**

Priority queues, union-find sets, (augmented) interval trees, (augmented) balanced BSTs and binary indexed trees

- Binary Indexed Tree or Fenwick tree
- Segment Tree (RMQ, Range Sum and Lazy Propagation)
- K-D tree (See insert, minimum and delete)
- Union Find Disjoint Set (Cycle Detection and By Rank and Path Compression)
- Tries
- Interval Tree

More Advanced Data Structures.

**Sorting and Searching : **Concentrate to learn the basic concepts and also get familiar with all the library functions available.

**String manipulation : **Strings make programming problems interesting and difficult too and probably thats the reason they are used extensively in such contests. Learning library functions for String actually proves very helpful (C++ : See this and this, String in Java).

**Choosing the right Language :** C++ is till date most preferred language followed by Java when it comes to programming contests but you should always choose a language you are comfortable with. Being CONFIDENT in any language is most important.

**Standard Template Library** : A quintessential especially for those using C++ as a language for coding

- Power up C++ STL by Topcoder – Part 1, Part 2
- C++ Magicians – STL Algorithms

**Dynamic Programming**

- Longest Common Subsequence
- Longest Increasing Subsequence
- Edit Distance
- Minimum Partition
- Ways to Cover a Distance
- Longest Path In Matrix
- Subset Sum Problem
- Optimal Strategy for a Game
- 0-1 Knapsack Problem
- Assembly Line Scheduling
- Optimal Binary Search Tree

**BackTracking**

**Greedy Algorithms**

- Activity Selection Problem
- Kruskal’s Minimum Spanning Tree Algorithm
- Huffman Coding
- Efficient Huffman Coding for Sorted Input
- Prim’s Minimum Spanning Tree Algorithm

More articles on Greedy Algorithms

**Graph Algorithms : **One of the most important topic which you can not ignore if preparing for ACM – ICPC.

- Breadth First Search (BFS)
- Depth First Search (DFS)
- Shortest Path from source to all vertices **Dijkstra**
- Shortest Path from every vertex to every other vertex **Floyd Warshall**
- Minimum Spanning tree **Prim**
- Minimum Spanning tree **Kruskal**
- Topological Sort
- Johnson’s algorithm
- Articulation Points (or Cut Vertices) in a Graph
- Bridges in a graph

**Basic Mathematics**

**Arithmetic**** :** Programmers must know how integers and real numbers are represented internally and should be able to code high-precision numbers. Bit manipulation tricks and knowing library functions for number basic arithmetic would be very helpful.

**Number theory : ** Knowing some of these concepts would save a lot of time and efforts while programming in the contests.

- Modular Exponentiation
- Modular multiplicative inverse
- Primality Test | Set 2 (Fermat Method)
- Euler’s Totient Function
- Sieve of Eratosthenes
- Convex Hull
- Basic and Extended Euclidean algorithms
- Segmented Sieve
- Chinese remainder theorem
- Lucas Theorem

**Combinatorics : **Although directly might not seam to be important, Combinatorics is important to estimate asymptotic complexity of algorithms.

**Geometrical Algorithms**

- Convex Hull
- Graham Scan
- Line Intersection
- Matrix Exponentiation and this
- Online construction of 3-D convex hull
- Bentley Ottmann algorithm to list all intersection points of n line segments
- Rotating Calipers Technique
- Area/Perimeter of Union of Rectangles
- Closest pair of points
- Area of Union of Circles
- Delaunay Triangulation of n points
- Voronoi Diagrams of n points using Fortune’s algorithm
- Point in a polygon problem

**Network Flow Algorithms**

- Maxflow Ford Furkerson Algo and Edmond Karp Implementation
- Min cut
- Stable Marriage Problem
- Dinic’s Algorithm for Maximum Flow and Wiki
- Minimum Cost Flow Problem
- Successive Shortest path Algorithm
- Cycle Cancelling algorithm
- Maximum weighted Bipartite Matching (Kuhn Munkres algorithm/Hungarian Method)
- Stoer Wagner min-cut algorithm
- Maximum matching in general graph (Blossom Shrinking)
- Gomory-Hu Trees
- Chinese Postman problem(Please see this too)
- Hopcroft–Karp Algorithm for Maximum Matching

All Articles on Geometric Algorithms

**More Advanced Stuff**

Bit Algorithms , Randomized Algorithms , Branch and Bound , Mathematical Algorithms , Heavy Light Decomposition, A* Search

**Informative Articles that you may like to read**

- An Awesome list for Competitive Programming – Codeforces
- What are the algorithms required to solve all C++ problems in Contests ? – Quora
- Best books and sites to prepare for ACM-ICPC – Quora
- Introduction to Programming Contest – Stanford.edu
- World Final Problems of ACM-ICPC – icpc.kattis

**References:**

Programming Camp Syllabus

This article is contributed by **Vishwesh Shrimali in association with Team GeeksforGeeks**. If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, missing or you want to share more information about the topic discussed above.

## Recommended Posts:

- How was my experience at ACM-ICPC Regionals?
- What is Competitive Programming and How to Prepare for It?
- How to prepare for Facebook Hacker Cup?
- How to prepare for Google Asia Pacific University (APAC) Test ?
- Construct a string that has exactly K subsequences from given string
- C/C++ program for Armstrong Numbers
- Replace each element of Array with it's corresponding rank
- Check if N can be obtained by repetitive addition or subtraction of two given numbers
- Count of all subsequences having adjacent elements with different parity
- Square root of a number by Repeated Subtraction method
- Largest sum contiguous subarray having only non-negative elements
- Check if a decreasing Array can be sorted using Triple cyclic shift
- Count of submatrix with sum X in a given Matrix
- Rearrange an array such that product of every two consecutive elements is a multiple of 4