views:

467

answers:

6

I'm participating in the Competencia Latinoamericana de Programacion this month and I was wondering if any of you have ever programmed competitively. The contest is basically 10 questions and I have to design an algorithm for each question with a team of 2 other people.

What are some things I should be ready for?

What exercises should I practice to prepare?

What book should I read to better myself in the logic area?

Programming related btw...please don't mark it as non-programming related.

+4  A: 

Whew! don't forget to get 8 hours of sleep before the contest :)

Crimson
Is it really that hard?
Sergio Tapia
Yes. And it's really required. There are a few of sport contests that last that long as programming ones.
Pavel Shved
A: 

I think you should read the book "programming pearls". One of my friends showed me that book few days back and it is really nice book. It shows some ways to do the things very effectively without using conventional methodologies.

Don't read the entire book. Just have a glance. :-) you can find ebook of this commonly

Chathuranga Chandrasekara
+5  A: 

"Design an algorithm"? Well, I assumed the goal is to provide source code with a solution that will be automatically tested. I.e. I meant this contest.

First, you should understand that ICPC contest is sports. To get success in sports it's obligatory to have regular trainings. Reading books alone is of no help. You can't become a good soccer player by reading books.

Gather with your team every week and solve contests, learn new algorithms and get accustomed to each other. Arrange roles and specializations, collect a good team that can act together (this may not be just 3 best programmers in your univercity). For trainings you can use problem sets from various local cintests, and online contests (acm.uva.es, acm.timus.ru, google for more) and just solve problems and check them online. If you're in contact with a university with a strong system of preparation and training ICPC competitors, you may try to particpiate in their trainings too.

Train, train, train. And have a bit of talent, of course.

And prepare to the fact that you're gonna lose this time. You have a year to prepare to win the next contest. Cheer it up and good luck.

Pavel Shved
+1  A: 

Assuming you haven't already, try working with your team on a few of the Project Euler problems. Time yourselves, set up mock contests for yourselves (pick 5 at random and expect yourselves to solve 4 in a certain amount of time) etc.

Spencer Ruport
IMHO, Project Eueler is of no help to ICPC. It's just training in a relative field.
Pavel Shved
+2  A: 

Start reading algorithm tutorials on TopCoder.com. They are very excellent. U can also practice in competition arena. They have match editorials which contains explanation to all problems of previous competitions. Try to understand the coding practices of coders of high rating at TopCoder Read book "Programming Challenges" by Steven Skiena and "CLRS". The only key to succeed in these contests is practice, practice and more practice

avd
+5  A: 

Pavel Shved already gave good tips, I have a few (a lot!) more too. (and I do have experience on this type of competition)

Get a good team

A good team isn't just the best programmers. A good team is a mixed one, where each person completes the skills of each other. In other words, one might know a lot about graph theory, while another be excellent in dynamic programming, and so on.

It makes no sense two have a team with 3 people who only know about the same subject. The team as whole must be able to solve lots of problems, and a mixed team helps on that.

Make the team act as a team

You're not alone in this competition. There are two people together with you, with one objective: solve as many problems as possible, as fast as possible, with as few mistakes as possible.

Thus, you all should be friends, and should be able to help eachother. No one is know-it-all, and every one of you will make mistakes. Don't blame or punish eachother, you are all one team.

Keep training at least once a week

Keep training. Only then you all will be good at solving problems. Try to setup an environment similar to the competition:

  • one machine for the entire team
  • a printed version of the problems (one copy is fine, but three copies would be better)
  • if possible, the same software as the competition (operating system, compilers, text editors)
  • 5 hours of duration
  • no interruptions (no one calling you on the phone, no instant message or e-mail...)
  • no looking for solutions at the Internet (it's fine to look at books)

Develop a strategy for the competition

Remember: you have roughly 15 man-hour but only 5 computer-hour. You must develop some strategy to optimize the use of computer. Here are some tips:

  • avoid debugging on the computer
  • absolutely no step-by-step debugging on the computer (it takes too much precious time)
  • don't stop to think about the problem while in front of the computer (you should think about it on paper, outside the computer, and write a rough algorithm on paper, before writing actual code)
  • get used to the software environment before the actual competition
  • automate repetitive tasks (but don't spend too much time on that)

Basically, for each problem, the person should write a rough solution on paper and discuss about it with another one from the team way before going to the computer. This helps a lot to find errors very early.

Start thinking about test cases for the problem even before implementing it. Also ask for another person think about test cases: a fresh mind usually has different ideas.

Never type the input directly to the program. It is error-prone and takes too much time. Always write the test cases to a text file on the computer and use stdin redirection to feed it to your program. You may also redirect stdout to some file, and automatically compare it to the expected output.

If you get stuck while doing something at the computer, notify your teammates, they might help you to get unstcuk, or they might want to use the computer to solve another problem and thus you should leave the computer.

Every once in a while during the competition, take a break to relax your mind. Get up, walk, drink and eat something, go to the bathroom... These things seem silly, but they really help.

Only start writing the program at the computer if you are sure it works on paper. After writing it, only submit your solution if you are sure it is working. Spend a couple of minutes looking for silly mistakes and writing more test cases. Submitting a correct solution 2 or 3 minutes later is better than receiving a NO answer and 20 minutes of penalty.

When you receive a NO answer, DON'T PANIC. Get a printed copy of your code (actually, ask for printing right after you submit it) and try to find the mistake on paper. This frees up the computer for use by someone else.

Have fun

And, the most important of all: Have fun!

Enjoy all the time spent on training, and all the time before, during, and after the competition.

Denilson Sá