I`ll outline the procedure for getting started in Algorithm Competitions in Topcoder.
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.
- Resources – Topcoder is loaded with them. From excellent tutorials on every algorithmic subject to really responsive forums, it`s the one of the places where you can find every resource needed to improve your algorithmic 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 ” College Of Engineering Guindy, Anna University”. This is important to increase our college ratings in colleges rank list. Another important thing is referrer handle – put “vijay03″ ( 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:
- Download the Topcoder arena. Click here to download. You will need Java and Java Web Start for it to run.
- Assuming you`d be coding in C++, download g++ for windows here. Install it using given instructions.
- Download KawigiEdit here. Install it using information given here.
- Now run your Topcoder arena by double clicking on the applet you downloaded in step 1
- Login with your Topcoder username and password.
- In the menu given in the Applet, select Practice Rooms, Select SRMS, Select 289-304, then SRM 343 Div 2.
- You should get a message saying, moving to Room ( or something similar )
- Once inside the room, click the button next to “coding” in the centre of the screen and click 250.
- 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 )
#includes...
using namespace std;
class PersistentNumber {
public:
int getPersistence(int);
};
int PersistentNumber::getPersistence(int n) {
}
<%:testing-code%>
//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 getPersistence(int n) method.Here`s the code again, after filling in the logic.
class PersistentNumber {
public:
int getPersistence(int);
};
int PersistentNumber::getPersistence(int a) {
long long int p=1;
long long int q;
int count=0;
q=a;
while(q>10)
{
a=q;
while(a>=10)
{
p=p*(a%10);
a=a/10;
}
q=p*a;
count++;
p=1;
}
if(q==10)
count++;
return count;
}
<%:testing-code%>
//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 71/71? 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
hey
thanks a lot for this one too. beginners like us will definitely get benifitted by this.
@Smrithi:
No problem. I love writing
@Smrithi:
And I am a beginner too
Great work!!
I guess everyone will now start practicing and compete in coming SRMs.
Thanks
thats is really gud work
.. keep it going..
Thanks da
Hey gr8 work dude…………
Keep it up!!!!
I am also a newbie and got a gr8 help.
@shankhs :
Thanks!
hey..
that was a real help. tanx:)
@madhumitha:
Glad to help
What are the instructions for setting up topcoder arena ubuntu linux?
Same as those for widows, just replace the installation instructions of java in windows with those in linux. You will also need to install the build-essential package. Try using apt-get for that.
Thank you for this Great Information, It helps me a lot.
Congratulations!This has been posted on TopCoder’s main page(http://www.topcoder.com/tc) Great going man!
yup me too..who left coding …will start soon..!!
@samshu
Thanks!
[...] 10, 2009 by vijay03 Check out the Topcoder /tc page! This blog post is featured there. I have to thank Twitter for this. I think this came about because Denis Horgan [...]
What I wonder is how are the top coders (very high ranks) program. Do they also program in Topcoder arena and use KawigiEdit ? What editors, IDEs they use for the SRM?
Yeah, I tried to look up on the videos of previous TCO, TCCC but couldn’t find much helpful. I would be really appreciate if you could post a similar entry about that.
Thankx,
@sanphu:
Petr releases screencasts of how he does his SRMs. You will find them in the SRM specific forums at Topcoder.
Other than that, I think just seeing the code of the people like Petr and tomek will give details about what plugins they use.
Thanks, vijay03.
thx bro…..nice wrk………but 1 problm is comming with my applet that i hve downloaded firstly in that applet my friend login with his account then after that i have made my account on topcoder but on topcoder site i can able to login by my account but on applet it show invalid/username password but wen i enter username and passwd of my friend then it gets easily login.
i can able to login on website but noty on applet i don’t know what is the reason.
if you have solution e-mail me megha131313@gmail.com