Archive for January, 2009

The winner of Human race

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

I open my eyes…… ah ! the joy of a new day

No matter what comes along….. my happiness will stay

I take a deep breath….. I’m glad I’m alive

The rest of the day is a bonus…. no matter how hard I strive

I’ll go for a walk…. no matter what weather

I’ll walk in the fields…. smell the grass and the heather

I know I’m a winner…. I see in the right vein

To me all of life…. is joy, a gain and a gain

My work is just a game…. I like to play

I love the hunt…. the chase…. the fray

I welcome the challenges…. I’m a smiling gladiator

Impossible to defeat…. a laughing mediator

When everyone says it can’t be done…. just get on with it and do it

When things get loose…. roll up your sleeves and screw it

When things become old hat…. think and new thought to renew it

Remember

There are always two ways…. the hard way or the easy way to do it.

Advertisements
Read Full Post | Make a Comment ( 2 so far )

U+I

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

Sometimes I wonder who are you,

sometimes I wonder what you are.

You are the one in my dream

and you are the one in my team.

You are the reason for my smile

and walking with me every mile.

You are the one cheering me

and you are the one steering me.

You are the thought in my mind and the feeling in my heart,

I wish together we may stay and never part.

You are my confidence, you are my faith,

You are in every breath that I take.

You are in memories of yesterday

causing the excitement today.

You are the happiness of tomorrow,

You take away all my sorrow.

…………………………………………………..to be continued….

Read Full Post | Make a Comment ( 3 so far )

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 )


#includes…
using namespace std;


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

};

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

}

<%: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 count(string dithered, vector <string> screen) method.Here`s the code again, after filling in the logic.

 

class ImageDithering

{

  public:

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

  {

    vector<bool>is(26,false);

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

      is[dithered[i]-'A']=true;

    int res=0;

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

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

        if(is[screen[i][j]-'A'])

          res++;

    return res;

  }

};

 <%: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 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 )

Read Full Post | Make a Comment ( 4 so far )

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