0% found this document useful (0 votes)
3 views

Lec01-Introduction to Competitive Programming

Competitive programming is a mind sport focused on solving computational problems using programming languages, primarily C++, under specific constraints. The International Collegiate Programming Contest (ICPC) is a key event featuring multi-layer contests, while the National Collegiate Programming Contest is significant in Taiwan. Various online judges and problem specifications are used to evaluate submissions, with an emphasis on computational complexity and asymptotic notations.

Uploaded by

BT Me
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Lec01-Introduction to Competitive Programming

Competitive programming is a mind sport focused on solving computational problems using programming languages, primarily C++, under specific constraints. The International Collegiate Programming Contest (ICPC) is a key event featuring multi-layer contests, while the National Collegiate Programming Contest is significant in Taiwan. Various online judges and problem specifications are used to evaluate submissions, with an emphasis on computational complexity and asymptotic notations.

Uploaded by

BT Me
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Introduction to Competitive

Programming

1
What is Competitive Programming
• A mind sport
• Solving a set of problems
• Often related to computation, algorithms and data structures
• Most of the contests are EECS students.
• Some problems are also used for job interview.
• By using programming languages
• C++ is the most popular choice.
• With certain restrictions and limited resources
• Time
• Memory
• Length of code

2
International Collegiate Programming Contest
• The most important collegiate programming contest.
• Multi-layer
• World Finals (2025/08/31—09/05 @Baku)
• League Championship or Playoff Round (2025/02/27—03/02 @Singapore)
• Regional Contest (2024/11/17—18 @Taichung)
• Preliminary Contest
• Taiwan Online Programming Contest
• Private University Programming Contest
• Technology University Programming Contest

3
ICPC-Style Contests
• 3 contestants form a team
• Share one computer
• Typically 5 hours
• Some preliminary contests only last for 3 or 4 hours
• 8 to 15 problems
• No partial credit
• Penalty:
• (minutes passed after begin) + 20*#(unsuccessful submission before accepted)
• Winner solve most problems
• Tie-breaker: least total penalty, then earliest last accepted submission.
4
National Collegiate Programming Contest
• The most important domestic ICPC-style contest in Taiwan.
• At most 6 teams per university in the final.
• The NYCU representatives are selected by NYCU annual programming
contest.
• Expected time: 1 week before 2025 fall semester
• Must commit at least 5 hour for team practice per week in the contest season
• Being the top 2 3 universities in Taiwan in recent 10 years.

5
Online Judges
• UVa
• Kattis
• CodeForces
• AtCoder
• vjudge

6
Contest Problem
• Description
• Input Format
• Output Format
• Specification
• Input size
• Time limit
• Memory limit
• Output limit
• Compilation limit

7
Judge Responses
• Yes / Correct / Accepted
• CE: Compilation Error
• WA: Wrong Answer
• TLE: Time Limit Exceeded
• RE: Run Time Error
• MLE: Memory Limit Exceeded
• OLE: Output Limit Exceeded

8
Sample Problem: Majority Vote
• Description
Suppose you are given n numbers a1, …, an. More than half of them
equal x. Please write a program to find out the value x.
• Input format
The first line of the input contains an integer n, and the second line
contains n numbers a1, …, an separated by blanks.
• Output format
Output x on a line.
• Specification
a1, …, an are 32-bit integers, and n < 107. Time limit is 1 second, and
memory limit is 50 megabytes.
9
Computational Complexity
• Time complexity
• TLE
• Space complexity
• RE or MLE
• Descriptive complexity (Kolmogorov complexity)
• Too late
• Communication complexity
• Circuit complexity

10
Word RAM Model
• RAM = Random Access Machine
• Turing machine is not a RAM.
• Word RAM
• Access a w-bit word with a single operation
• Perform bitwise operations, including addition and shift, in constant time
• U, the number of possible values, is bounded by 2w.
• We assume word RAM model in this class.
• Sometimes, we also assume multiplication and division can be done in
constant time.

11
Asymptotic Notations
• Big-Oh: f(n)=O(g(n))
• Little-Oh: f(n)=o(g(n))
• Theta: f(n)=Θ(g(n))
• Big-Omega: f(n)=Ω(g(n))
• Little-Omega: f(n)=ω(g(n))

12

You might also like