What is the Olympiad in Informatics (OI) / competitive programming?
Competitive programming is a mind sport where participants (individuals or teams) try to solve well-defined programming problems within a specific time limit. These problems require algorithmic thinking, data structure knowledge, and efficient coding and debugging skills. Solutions are automatically evaluated by judges on their correctness and efficiency (time and memory usage) using hidden test cases. It's a challenging activity that helps improve problem-solving abilities and programming proficiency.
What are some examples of programming competitions?
There are numerous programming competitions at various levels, including:
- International Olympiad in Informatics (IOI): A prestigious annual competition for secondary school students.
- China National Olympiad in Informatics (NOI): The national competition for secondary school students in China.
- International Collegiate Programming Contest (ICPC): A world-renowned competition for university students. Contestants participate in teams of 3.
Locally, we organise the following competitions for secondary school students:
- Hong Kong Olympiad in Informatics (HKOI)
- Hong Kong Girls’ Olympiad in Informatics (HKOI)
- Software Development Invitational Contest (SDIC & CSP-J/S)
- National Olympiad in Informatics in Provinces (NOIP)
Other local competitions include:
- Hong Kong Secondary School Coding Challenge organised by City University of Hong Kong
- La Salle-Pui Ching Programming Challenge
When solving an OI task, do I need to validate the input?
Generally, no. In most Olympiad in Informatics competitions and competitive programming contests (including HKOI/HKGOI), it's assumed that the input will strictly adhere to the specified format and constraints described in the problem statement. You don't need to write extra code to check for invalid input unless the problem explicitly states otherwise. Focus your efforts on solving the problem with the given valid input.
How are programs evaluated?
Programs are evaluated automatically by the Online Judge. The process involves:
- Compilation: Your submitted source code is compiled using the specified compiler and flags.
- Execution: The compiled program is executed against a set of test cases (input data) that are unknown to the contestants.
- Performance Measurement: The program's execution time and memory usage are measured to ensure they are within the specified limits. Exceeding these limits will result in a "Time Limit Exceeded" or "Runtime Error" verdict.
- Output Verification: The program's output for each test case is compared to the expected output (predetermined by the judges).
- Scoring: Points are awarded based on the number of test cases passed. For HKOI and HKGOI, you can score points for a subtask if you pass all test cases in that subtask.
Does my code need to be readable?
While we don't explicitly judge code quality or style (like variable naming or comments), writing readable code is recommended. Clear and well-structured code makes it significantly easier to debug during the time-pressured competition environment. Using meaningful variable names, adding comments for complex logic, and following consistent formatting practices can save you valuable time and frustration when trying to identify and fix errors.
Will knowledge of mathematics be useful in OI?
Computers work with numbers. That is why mathematics, especially discrete mathematics, is tested in Informatics Olympiads.
Will knowledge of Linux be useful?
Yes. For all competitions organised by us, including HKOI, HKGOI, SDIC and NOIP, the virtual machine that the students use for developing their solutions is based on Linux. For HKOI and HKGOI, we also provide a simple web-based IDE (HKOI Online Judge “Code” feature) which many students find useful.