Getting Started on Topcoder

Posted on January 29, 2009. Filed under: TopCoder |

I`m including outlines of the procedure for getting started in Algorithm Competitions in Topcoder as written by Vijay in his blog.

So what`s Topcoder?

Its a company that conducts contests on a regular basis in the fields of algorithmic programming and software development.

Why does it do it?

Programming contests are a way of identifying people good programming ( and general computer science ) talent. Companies pay good money to easily identify top talent for their company. Plus Topcoder acts as a sort of mediator between companies who want some custom software built quickly and developers who are willing to take on projects. It gets some money out of this.

So why should we be looking at Topcoder?

One factor is the fun. Another factor for the more earthy among us, is the money. You can win money at various levels in a Topcoder SRM. So lets get to it.

How is Topcoder different from SPOJ?

  • The major difference is the competing style. SPOJ is based on the ACM ICPC model, where you solve problems on your local computer and upload your source file to be judged. On the other hand, Topcoder is based on the Applet Model, where you use a tool given by the people who conduct the contest to write your programs, compile them and submit, all in one place.
  • Time factor. In SPOJ you can code and submit problems at any time of the day and the problem contributes towards your rank. In Topcoder, though you can code and submit problems at any time, only during contest times will it affect your rank.
  • Topcoder lets you see other the code of other people after the contest. In this way, you can see how the really good people are coding and improve your coding style and knowledge.
  • Time factor – Unlike in SPOJ, where you can take your own time to solve a problem, in Topcoder, at least in SRMs, you have to solve problems within a time limit of one hour fifteen minutes. Doing this well takes some fast thinking and speed in coding – things not reflected in SPOJ
  • Professionalism – Topcoder is just a level more professional than SPOJ at conducting programming contests, for the simple reason that it is commercial. After each SRM, you can compare how you did with your friends, other people in your country, and whole lot more. You also get an editorial after each SRM, explaining the solution to each problem, so if you can`t get it in one SRM, you can get it in the next.

So on to our first SRM. First register with Topcoder here. Select “Competition Registration” and click Submit. Then fill out the form it gives you. Country and Country to Represent are the same thing. One important thing is School which denotes your college – give ”Army Institute of Technology”. This is important to increase our college ratings in colleges rank list. Another important thing is referrer handle – put “amit5148″ ( My handle in Topcoder )

Now you`ve just registered for Topcoder SRMs in general. You still need to register for each SRM. More on that later.

How to start practising on Topcoder:

  1. Download the Topcoder arena. Click here to download. You will need Java and Java Web Start for it to run.
  2. Assuming you`d be coding in C++, download g++ for windowshere. Install it using given instructions.
  3. Download KawigiEdit here. Install it using information given here.
  4. Now run your Topcoder arena by double clicking on the applet you downloaded in step 1
  5. Login with your Topcoder username and password.
  6. In the menu given in the Applet, select Practice Rooms, select SRMs, select 1-16, then SRM 145 Div 2.
  7. You should get a message saying, moving to Room ( or something similar )
  8. Once inside the room, click the button next to “coding” in the centre of the screen and click 250.
  9. Another topcoder applet window should open, containing the problem set. You will be using this window to code, compile, test and submit your solution.

The top portion of the window contains the problem statement. The bottom portion contains an area where you can type your code. This is what the coding bottom portion of the screen initially looks like for me.( If you have KawigiEdit that is, otherwise its just blank )

using namespace std;

class ImageDithering {
int count(string, vector <string>);


int ImageDithering::count(string dithered, vector <string> screen) {


//Powered by [KawigiEdit] 2.0!

This is where Topcoder differs from most other online competitions. There is no main() method in the code! That is because Topcoder evaluates your code in a different manner. It creates an object of your class and runs the method mentioned in the problem statement. This is why the method has to be public. It passes different arguments to the method and checks the return value of the method with expected return value. DONT print out the answer in Topcoder, it doesn’t help you any ( except maybe for debugging ).

Now you have to type your logic into the method specified in the problem statement. In this case, the count(string dithered, vector <string> screen) method.Here`s the code again, after filling in the logic.


class ImageDithering



  int count(string dithered, vector <string> screen)



    for(int i=0;i<dithered.length();++i)


    int res=0;

    for(int i=0;i<screen.size();++i)

      for(int j=0;j<screen[0].length();++j)



    return res;




//Powered by [KawigiEdit] 2.0! 


The above is not my best code, was written ages ago, so don’t judge me by that ) After doing this, try clicking on Compile button. You should get a message saying your code compiled without any errors. Now you can test your code with the example cases. After testing, click Submit.

Go to the Applet, click on Practice Options->Run System Test. You should see a dialog box running your code against various arguments and checking the results. If your code fails for any case, you can see which case it is in this window. You can fix your submission and resubmit as many times as you want, in the practice room.

Saw a green 250 with 49/49? Congrats, you`ve just solved your first problem on Topcoder in the practice room ) I`ll cover registering and participating in a Single Round Match ( SRM ) in another article. Have fun in Topcoder )


Make a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

4 Responses to “Getting Started on Topcoder”

RSS Feed for Amit’s Diary Comments RSS Feed

Hi! I’m thrilled you’ve liked my blog post enough to include it in your blog, but please do leave a note saying where some of the content was from 🙂


In the original post at , the author mentioned “green 250 with 71/71” …. here its “green 250 with 49/49”

Can you please tell me about the technical difference? I really dont understand Topcoder’s rating system.

Updated & thanks 🙂

250 indicates the maximum points one can score.
49/49 indicates that there were a total of 49 test cases during system test and my code passed 49 of them.
Green indicates that my code passed all test cases else it would have been red.
In his post, Vijay wrote 71/71 because the problem taken by him as example contains 71 test cases.

Where's The Comment Form?

Liked it here?
Why not try sites on the blogroll...

%d bloggers like this: