Competitive Programming Introduction (A Guide For Beginners)
Staying longer with problems is the key to the solution
Points to be noted:
1. Write reliable and effective programs.
2. Learn and practise algorithms.
3. Manage time when it is very limited.
4. It does help with job interviews.
5. Move with people to stay motivated.
Competition Specifics:
Question format and requirement:
1. Precisely formulated, although often through some real-world legend.
2. Input/output exactly of certain (desired) format
3. Have tight time/memory limits
4. Efficiency is key to success
5. Often require knowledge of some algorithms and ideas
Problem solution:
1. Usually short and a few dozen lines of code
2. Is repeatedly run on a testing system against prepared test cases.
3. Must not use external libraries, create extra files, go to the network and so on.
Testing System Verdicts:
1. CE: Compilation Error (the compiler couldn’t compile your program)
2. RE: Runtime Error (your program crashed during the execution)
3. TL: Time limit Exceeded (your program didn’t exit in the allotted time)
4. ML: Memory limit Exceeded (your program tried to use too much memory)
5. PE: Presentation Error ( your output was formatted incorrectly)
6. WA: Wrong Answer (your output is not corrected)
7. AC: Accepted (your program passed all tests, congratulations!
Steps of solving a problem:
1. Read the statement
2. Formalize it
3. Invent a solution
4. Prove it
5. Implement it
6. Test your implementation
7. Debug if not working
8. Submit and get AC(hopefully)
What is proving?
1. Why not just implement on the “obviously correct” solution?
2. Often solutions base on wrong assumptions.
3. Both correctness and efficiency could depend on it.
4. So if you assume anything, it must be either written in the statement or proven.
5. Proving correctness of greedy algorithms and bounds on running time in general – later on, this blog.
Competitions
1. Google code jam – used for recruiting
2. Facebook hacker cup - used for recruiting
3. Codechef monthly long challenges, lunchtime and cookoff
4. TopCoder (rating system)
5. Codevita by TCS
6. Codeforces – regular
7. Hacker rank
8. Hacker earth
9. CSAcademy
10. Sphere online judge
And many more, There are also many online contests that are open to everybody. At the moment, the most active contest site is Codeforces, which organizes contests about weekly. In Codeforces, participants are divided into two divisions: beginners compete in Div2 and more experienced programmers in Div1. Other contest sites include AtCoder, CS Academy, HackerRank and Topcoder. Some companies organize online contests with onsite finals. Examples of such contests are Facebook Hacker Cup, Google Code Jam and Yandex.Algorithm. Of course, companies also use those contests for recruiting: performing well in a contest is a good way to prove one’s skills.