2Welcome to the first annual #HackSGF High School Coding Competition. Our rules have been adapted from the ACM ICPC rules (http://acmacpc.org/rules/) and are as follows:


  1. Contestants (and reserve) must wear the official contest T-shirt during the contest.
  2. Contestants may only use one computer per team during the contest. Teams may bring spare computers for use if primary computer fails. Computer should include Web Browser, and Java or Python development tools they are familiar with.
  3. Contestants may only bring printed material to the contest hall.
  4. Cellular phones (mobiles) are strictly prohibited inside the contest area.
  5. All bags brought into the contest area will be checked.
  6. Contestants are not allowed to talk to their coaches during the contest. In general, contestants are not to converse with anyone except members of their team and personnel designated by the contest director (e.g. for assistance submitting problems to the scoring system).
  7. A team may be disqualified by the contest director for any activity that jeopardizes the contest such as dislodging extension cords, unauthorized modification of contest materials, or distracting behavior.
  8. Until the contest begins, contestants are not allowed to touch anything at the team workstation until so directed by the contest director or contest area supervisor.


  1. Contestants compete in teams of 1-3 students.
  2. Each student must be enrolled in a high school (or equivalent program) in Southwest Missouri and surrounding regions.

Contest Format

  1. The contest will last exactly two hours (unless there is an unforeseen difficulty that requires extending the time.)
  2. The contest problem-set is made of eight to twelve problems. Each team attempts to solve as many problems as possible using a single computer.
  3. The programming languages are: C, C++, JAVA, PYTHON 2, or PYTHON 3. Contestants are free to choose the programming language(s) they want to use.
  4. A contestant may submit a claim of ambiguity or error in a problem statement by submitting a clarification request. If the judges agree that an ambiguity or error exists, a clarification will be issued to all contestants. Notification of accepted runs may be suspended at an appropriate time to keep the final results secret. Notification of rejected runs will continue until the end of the contest.
  5. Solutions are judged by running them against secret test cases. The contest judges are solely responsible for determining the correctness of the submitted solutions and their decision is final.
  6. Rejected runs are further classified into:
    • Syntax error: The program failed to compile.
    • Run-time error: The program crashed during run.
    • Time limit exceeded: The program failed to terminate within the allowable time period.
    • Wrong answer: The program terminated successfully, but the output wasn’t correct.
    • Presentation Error: The program terminated successfully, but the output wasn’t formatted as expected. (Note that getting this error doesn’t mean that the output is correct, it is possible for the output to be wrong too.)
  7. If a run is rejected, the team is free to try again and send as many runs as they wish until the problem is solved (but make sure you understand the scoring rules.)

Problem Format

  1. Every effort is made to guarantee that problems avoid dependence on detailed knowledge of a particular application area or particular programming language.
  2. Each problem will require reading input from a specific text file, and printing its output to the standard console. (Hint to coaches: Make sure at least one team member can read data from text files.)
  3. Since judging is a semi-automatic process, it is mandatory for the program output to match the output format specified in the problem description.
  4. The judges’ secret input file will test the program on multiple cases (or datasets.) The format of the input file will be designed so that multiple datasets can be included in a single text file.
  5. Each problem in the contest is specified in the following four sections:
    • Description: This section specifies the problem contestants are supposed to solve.
    • Input format: Here you’ll find detailed description on how the input file will be formatted.
    • Output format: This section specifies the format of the output of your program. Your program’s output must conform to the format specified.
    • Sample Input/Output: Here you’ll find a sample Input/Output that has successfully passed the judges’ program.
    • Note: Your program will be tested on a different (and more complex) dataset. Just because your program passed the sample Input/Output, doesn’t mean it is correct.
  6. In addition, the problem statement will specify the name you should use for your program, and the name of the input file.
  7. Since compilation and testing is an automated process, it is important that you follow the naming convention exactly. For example, if the problem statement states that the files should be named “easy” then the program file must be named “easy.java” for a JAVA program, “easy.py2” for a Python 2, or “easy.py3” for a Python 3 and the input file will be named “easy.in”.

Programming Your Solutions

  1. Programs must be in a single source file with the name specified in the problem description; failure to meet this requirement is a “Syntax or Compilation Error”. ***Note for Java programmers***: You can still have more than one top-level classes in a single source file as long as only the main one is declared public while the rest are unqualified (i.e. just “class”, without “public”).
  2. Output will be judged using a file comparison utility. Output must be exactly as specified in the output format section: Spelling, punctuation, spacing, and case (uppercase/lowercase) are all significant (unless specified otherwise in the problem statement.)
  3. Your program cannot require any intervention from the user. All input must be read from the input file. If you submit a program that requires user intervention, you’ll most probably receive a “Time-Limit Exceeded” error. Contestants who have the habit of placing a “press any key to continue” statement at the end of their program should pay attention to this point.
  4. Do not use drive and/or path specifications when naming input files. The input file will be in the same directory as your program.
  5. All test cases used in judging will conform to the input specifications. There is no point for your program to try to detect invalid input or a missing input file.
  6. Make sure your program will compile and run locally before you upload your solution.

Contest Scoring

  1. Teams are ranked in a descending order according to the number of problems they solve.
  2. Teams who solve the same number of problems are ranked ascendingly by total time (the score).
  3. The total time (aka score) is the sum of the time consumed for each problem solved.
  4. The time consumed for a solved problem is the time elapsed from the beginning of the contest to the submittal of the accepted run; plus 5 penalty minutes for every rejected run (for that same problem.)
  1. There is no time consumed for a problem that is not solved (even if there are rejected runs for it.)
    Consider the following team which submitted 6 runs, three for problem A, two for problem B, and one for C. For each submitted run, the table shows the time of the submission, for which problem, and the judge’s’ response for that particular run. For solving problem A, the time consumed is 17 plus 2*5 for the two unsuccessful runs. For solving problem B, the time consumed is 0 since both runs were unsuccessful. For solving problem C, the time consumed is 13 minutes. So the total time for this team 17+2*5+0+13 = 40. (Notice that no penalties were added for problem B since it wasn’t solved correctly.)

Resolving Ties

  1. Teams solving the same number of problems with the same total time are ranked by the geometric mean of the individual times for each solved problem (smaller being better) without the penalties. Any remaining ties are left unbroken.

Judges’ Decisions

  1. Judges are solely responsible for accepting or rejecting submitted runs. In consultation with the judges, the contest director determines the winners of the contest. The contest director and judges are empowered to adjust for or adjudicate unforeseen events and conditions. Their decisions are final.


  • Hack 4 Good 2018 Participant Certificate (all attendees)
  • 1st/2nd/3rd place Trophies and Medals (1 trophy per team, 1 medal per teammate)
  • First to Solve Certificates (for each problem)
  • Extreme Programmers Certificates (based on efficiency of solution)
  • Solid Programmers Certificates (highest score w/ low number of attempts)
  • Relentless Programmers Certificates (highest score w/ high number of attempts)