Welcome to Computer Programming Contest Orientation Presented by Ahmed Shamsul Arefin The University of Newcastle, Australia [email protected]11/6/2011 1 Based on a Programming Contest Training Workshop by Shahriar Manzoor (Judge, WF Contest) and Rezaul Alam Chowdhury (Faculty, State University of New York at Stony Brook).
ACM ICPC Programming Contest Orientation. A Programming Contest Orientation Class held at The University of Newcastle (CS/SE Discipline, School of EECS). Presented by - Ahmed Shamsul Arefin (PhD Candidate, CS, Newcaslte U, AUS).
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
11/6/2011 6Picture Source : Internet/ Google Uncle!
Conduct of the Contest
• Exactly eight (8) to ten(10) programming
problems will be posed in English.
• Only one (1) computer is allocated for each
team.
• The contest will run for five (5) hours.
• Teams will try to write the solutions of the
problems in any one of the programming
languages allowed (C/C++,Java) and submit
for acceptance.
11/6/2011 7
Conduct of the Contest
Resource materials such as books,
manuals, and printed program listings.
11/6/2011 8
Allowed:
Machine readable versions of programs
or data.
Calculators, laptop/palmtop computers.
Mobile phones and other communication
devices.
Prohibited:
Conduct of the Contest
Conversation (during contest hours) with
anyone (including the coach) except
members of own team and system
support staffs.
Any activity that jeopardizes the contest.
11/6/2011 9
Prohibited:
Conduct of the Contest (del)
• The Chairman of the Program Committee has the authority to change the duration of the contest in the event of unforeseen difficulties.
• In case of interruption of power for duration of less than 30 minutes, contest will continue for at least half an hour after the restoration of power (Not Applicable in AUSTRALIA).
• In any case the exact timing will be decided according to the situation.
11/6/2011 10
Contest Duration:
Computing Environment
One team, one computer.
All the computers run on same operating system (Windows or Linux).
All computers are networked together.
Programming languages allowed are : C, C++ and Java.
Convenient development tools will be provided for each of the languages.
Solutions must be submitted to the judgesthrough network using the PC2 judging utility.
11/6/2011 11
Judgement
• If you are confident about your solution to a problem, submit it for judgement.
• Each of your submitted runs is judged as accepted or rejected, and you will be
notified of the results with full-screen messages.
11/6/2011 12
Judgement
Will be notified as Correct.
11/6/2011 13
Accepted Solutions:
Incorrect Output.
No Output.
Presentation Error.
Run Time Error.
Time Limit Exceeded.
Rejected Solutions:
Judgement
• Your solution must read input from a filespecified in the program description and produce output to the standard output.
• But when the judges test your program that input file contains some additional secret data specially designed to check the correctness of a solution.
• If the output of your program matches with what the judges expected, your solution is considered Correct.
11/6/2011 14
Correct:
Judgement
• If the output of your program does not
match with what the judges expect, you
will get an Incorrect Output notification.
11/6/2011 15
Incorrect Output:
Judgement
• Your program runs but does not produce any output for the judges’ secret input data.
11/6/2011 16
No Output:
Some Possible Causes:
The name or the path of the input file in
your program may be written incorrectly.
The input file will always be in the current
directory.
Assuming incorrect input data format.
Run time error.
Judgement
• Possibly your solution produces correct
output for the judges’ secret data, but
does not print it in the proper format.
11/6/2011 17
Presentation Error:
Some Possible Causes:
White-space and newline characters in
improper numbers and positions.
Spelling mistake.
Case mismatch.
Judgement
• Your program performs an illegal operationwhen run on the judges’ input.
11/6/2011 18
Run Time Error:
Some Illegal Operations:
Invalid memory access.
Divide by zero.
Overflow.
Domain error.
Judgement
• The judges allow your program to produce
output for their secret data within a specific
time period. If your program fails to do so,
you get a TLE notification.
11/6/2011 19
Time Limit Exceeded:
Some Possible Causes:
Using an inefficient algorithm.
Infinite loop.
Waiting for input from standard input
device.
Assuming wrong input data format.
Scoring
• Teams are ranked according to the most
problems solved (judged Correct).
• Teams who solve the same number of
problems are ranked by least total penalty
time.
• Teams who are still tied are ranked by the
earliest time of submittal of the last
accepted problem.
11/6/2011 20
Scoring
• Say a team has submitted the correct solution of a problem at the 120th minute, but made 3 rejected submissions before the correct one. So, penalty = 120 + 20 3 = 180 minutes.
• Now, if they submit the correct solution of another problem at the 300th minute with 4 rejected submissions before the correct one, then total penalty = (300 + 20 4) + 180 = 380 + 180 = 560 minutes.
11/6/2011 21
Sample Calculation:
(This figure is illustrative, i.e., based on a different penalty value)
Part Two
Tips on Team Strategy
Frequently Set Problems
Efficient Programming
Team Strategy
11/6/2011 22
A Good Programming Team
• Must have knowledge of standard algorithms and the ability to find an appropriate algorithm for every problem in the set.
• Ability to code an algorithm into a working program.
Every member need not know all arts of programming but everyone must have the basic skills of programming such as writing procedures, debugging, compiling.
Then some may be specialized for searching, graph traversing problems, some other dynamic programming and one should have deep knowledge of mathematics, etc.
11/6/2011 28
Tips on Team Strategy
Every team member should know every other
member’s weakness and strength so when he
reads a problem he should understand who is
The MAN to solve that problem.
11/6/2011 29
Tips on Team Strategy
Don’t waste much of your time with a
single problem. Your team mate may find a
good solution quickly for that.
Try to read all problems.
11/6/2011 30
Tips on Team Strategy
The team members should have good understanding between them because they will have to decide when one will leave the computer.
Always think about the welfare of the team. Contest is not a time to become selfish. You should not think like “Oh, I have finished my quota” or “I must solve one problem any how” or “I will be dropped next time.”
11/6/2011 31
Tips on Team Strategy
The most efficient way to write a program is to write it alone. Thus you avoid communication overhead and the confusion caused by differing programming style.
Solving problems together can also be helpful. This strategy works out when the question is hard. This is also good for the team whose aim is to solve at least one problem.
11/6/2011 32
Tips on Team Strategy
In a 5 hour contest you have 15 man hours
and only 5 computer hours. So computer
time is extremely valuable. It will be a great
pity if all three man are busy with solving
problems and the computer is left lonely.
11/6/2011 33
Tips on Team Strategy
If the easiest problem of the contest is getting
rejected for some silly mistakes then it is often
a good idea to redo the problem (by some
other member of the team).
11/6/2011 34
Tips on Team Strategy
Try to see the current standing and also
find out which problem is solved most. If
that problem is not solved by your team
then try to solve it immediately.
11/6/2011 35
Tips on Team Strategy
Use the chair in front of the computer only for typing and not for thinking. Write your program on the paper, analyze it and then go in front of the computer.
When your solution gets rejected by the judges try to think about your mistakes rather than debugging on the computer. REAL TIME DEBUGGING is the ultimate Sin.
11/6/2011 36
Final Words on Strategy
The Scoring system of a Contest is digital. So you don’t get any point for a 99 % solved problem. That is why, don’t try to attack too many problems. At the end of the contest you may find that you have solved all problems 90% and your team is at the bottom of the rank list.
11/6/2011 37
Sample Problem
I Love Big Numbers !• The Problem
• A Japanese young girl went to a Science Fair at Tokyo. There she met with a Robot named Mico-12, which had AI (You must know about AI-Artificial Intelligence). The Japanese girl thought, she can do some fun with that Robot. She asked her, "Do you have any idea about maths ?"."Yes! I love mathematics", The Robot replied.
• "Okey ! Then I am giving you a number, you have to find out the Factorial of that number. Then find the sum of the digits of your result!. Suppose the number is 5.You first calculate 5!=120, then find sum of the digits 1+2+0=3.Can you do it?"
• "Yes. I can do!"Robot replied.
• "Suppose the number is 100, what will be the result ?".At this point the Robot started thinking and calculating. After a few minutes the Robot head burned out and it cried out loudly "Time Limit Exceeds".
• The girl laughed at the Robot and said "The sum is definitely 648".
• "How can you tell that ?" Robot asked the girl. "Because I am an ACM World Finalist and I can solve the Big Number problems easily." Saying this, the girl closed her laptop computer and went away.
• Now, your task is to help the Robot with the similar problem.
38
I Love Big Numbers !
• The Input
• The input file will contain one or more test cases.
• Each test case consists of one line containing an integers n (n<=1000).
• The Output
• For each test case, print one line containing the required number. This number will always fit into an integer, i.e. it will be less than 2^31-1.