Title: A Cheerful Memory
1A Cheerful Memory
- My ACM experience
- By Chien-I Liao
21.Introduction - How do they score?
- Your program must compute all input correctly to
get a Yes. - The more problems you solve, the best your score
will be. - If two teams solved same number of questions, the
team with less penalty wins. - Penalty
- Once you got a Yes, the number of minutes
from start to the time you summit that solution
plus 20(Number of Wrong Answer you got on this
problem) will be added to your teams penalty. No
penalty before solving it!
31.1 Strategy Minimize Penalty
- Strategy 1Begin with easy problem!
- Strategy 2Use 5 minutes to double check
everything before submit to avoid 20 minutes
penalty!
Penalty10 30
60 Total 103060 100
Penalty 30
50 60 Total 305060 140
42. Time Schedule
- Find the easiest problem in 15 minutes, and
assign one to solve it. - Two teammates should finish reading all problems
before 30 minutes. - Finish first problem in 40 minutes.
- Solve 3 problems in 2 hours.
- If possible, 3 people could work on different
problem after that, try to solve 6 problems.
Otherwise, let one guy solve the 4th problem
while the other two cooperate to conquer the 5th.
53. Some useful Tips
- Read the problem VERY carefully AGAIN before
working on it and take GOOD care about I/O. - Design test data yourself or ask your teammate to
do so. Dont rely on sample inputs. - The extreme case must be tested. (0, for example)
- Write codes on paper if computer is not
available. - When wrong answer, do NOT debug on computer.
There should be a teammate ready to use it.
However, you may ask another one help you debug
on PAPER.
63. Some useful Tips (Cont.)
- Always explain your idea to another teammate, do
NOT start before you convince him/her. - Print a copy of your code right after you summit.
(And hope never use it again _) - If you got into trouble, also print a copy of
your code and write further codes on paper before
you resolve it.
74. How could it be wrong!?
- Even the easiest problem may have traps!
- Ex Input an integer N, Output the sum of all
- integers from 1 to N.
- Sample Input
- 3
- 100
- Sample Output
- 6
- 5050
8include ltiostream.hgt void main() int
n,i,total while(cin gtgt n) total0 for(i1
iltni) totali cout ltlt total ltlt
endl
Wrong Answer!
9How could it happen? Lets read the problem
again Input an integer N, Output the sum of all
integers from 1 to N. Sample Input 3 100 Sample
Output 6 5050 Any trap?
Yes! The problem did not say N is positive!
10Modify the program as following include
ltiostream.hgt void main() int
n,i,total while(cin gtgt n) total0 if(ngt0)
for(i1iltni) totali else for(i
1igtni--) totali cout ltlt total ltlt
endl
Yes!
for(i1iltni) totali cout ltlt total
ltlt endl
115. About I/O
- Take special care to spaces, new line, precision
and rounding. Read input specification VERY
carefully. - Use Copy-Paste to avoid typo!
- Compare with the Sample Output again before
summiting. You may summit a debug version! - Extreme value must be tested! Try to attack your
program by yourself. Usually its a good idea to
let your teammate attack it too.
126. Sort the difficulty of problems
- Usually, problems from the easiest to the hardest
- EASY Problem or Math Problem
- Dynamic Programming Problem
- Graph Problem
- Simulation or String Manipulation Problem
- Parser
- Geometric Problem
137. Prepare before Contest
- For individual
- Many Online Judge website provide problems and
judge program. Practice with them. - Read DS and Algo textbook thoroughly.
- Be familiar to read problems, even without
solving it. - Get used to the IDE provided in contest and
memorize hotkeys first! - Practice to write and debug codes on paper.
- Be skillful when debugging and always assume that
you dont have a computer to do so.
147. Prepare before Contest (Cont.)
- For team cooperation
- Practice a real problem set once a week together,
and find the best cooperation method. - Everyone should know each other very well, so
that you could give the problem you read to the
right person. - Practice to read your teammates code. Sometimes
you will have to do so in contest.
158. How to improve?
- Make a record yourselves (If possible, find
another guy to do so) for each five hour
simulation. Who is doing what at when? Is there
any time the computer is idling? - Did you waste the computer? Didnt anybody know
what to do next any time? - Did you judge problems difficulty correctly?
- Any reason for non-solved problems?
169. Library Preparation Why is it necessary?
- ACM RuleYou may bring any document, but you
cant bring any calculator or computer-readable
data, such as CD and Floppy disk. - LibraryUsually printed code. Should be bug-free,
of course. - Ex Wild-Integer, Point-Line Intersection case,
Min-Heap code.
179. Library Preparation(Cont.)
- Bring a dictionary!
- Introduction to Algorithm is a textbook I
strongly recommend to bring. - Define useful classes, e.g. Wild-Integer,
Polynomial, Point, Line and other geometric
thing. - Print useful algorithm code, e.g. Flow, DFS , MST.
1810. Miscellaneous
- Integer Arithmetic
- Float Arithmetic
- How to test your machine
- (1) Running idle loops to test CPU speed.
- (2) Open huge array to test memory limit.
- (3) Whats the error message if divide by 0?
- (4) Whats the error message if memory exceed?
19Finale
- ACM is just a game, try to enjoy it and dont
feel sad with bad results. It might not be your
fault!
20Acknowledgement
- I thank my teammate WuShi Lee, who provided many
useful data and information.