Saturday, January 13, 2007

An dissapointing topcoder contest....

Yesteday topcoder conducted its srm contest at 10:30 pm . Even though it was pretty late for us i did not mind since i usually sleep late into the night. It was damn cold in my room which was pretty unusual in a city like chennai . I donot know whether it was the climate or was it my body that started freezing ? This was my first top coder srm and i wished i did properly . I was not able to get the gist of the first problem . I got a bit confused . the second problem was regarding a problem validating a knight's move .
the full code is here :http://www.topcoder.com/stat?c=problem_solution&rm=263249&rd=10658&pm=7245&cr=20718854
for (int i = 0; i < cells.length; i+=2) {
if(!this.valid(parse(cells[i]),parse(cells[i+1])))
return "Invalid";
}
this loop was the mistake i did. here what i did was that i paired up two consequtive moves instead of sequence
so suppose you have a sequence of moves say
"D5", "F6", "C6", "A5",

so what my code did was validate knights move from D5->F6 and then the next validate C6->A5
however it should have been
D5->F6, F6->C6,C6->A5 .
then the corrected loop looks something like this
for (int i = 0; i < cells.length; i+=1) {
if(!this.valid(parse(cells[i]),parse(cells[i+1])))
return "Invalid";
}
so its i+=1 and not i+=2!!!!!
damn this seemed to be the easiest that top coder could ask and i messed it up!!!!

the next 1000 sum was easy.......but never did it strike me to use dp or memoization .
so i did the normal way and it took too much time to execute ! :(
http://www.topcoder.com/stat?c=problem_statement&pm=7244&rd=10658&rm=263249&cr=20718854
and here is my solution
http://www.topcoder.com/stat?c=problem_solution&rd=10658&rm=263249&cr=20718854&pm=7244

better luck next time!!!

Sunday, March 26, 2006

My First Music Class!

perhaps for too long have i been writing about my theories... for a change i thought i could write something about my life experiences....... so here goes one of them!

Well.... long long ago when i was still a small kid.......when the world was waiting to hear my beautiful voice, i thought of going to a music class to enhance my singing skills.........so near my house there was a karnatic music teacher

So i went to his house with the notion of mastering carnatic music.... so he gladly accepted me as his disciple and went on to teach me music.......well you know me! i showed him how loud i was.......he was wondering whether he made a mistake of taking me in!(though he didn show it out!)

so days went on and i was gradually improving in my singing skills......now each day the master had a visitor from the neighbourhood! they were asking the master "who is singing in such a beautiful voice"! and he directed them to me! So on the fourth day of my class as usual i started walking towards my music master's house......but i found his house locked for unknown reasons :((.... probably he was'nt well... so i walked back home! He didn come back even after 3 or 4 days.... i started getting impatient..
Suddenly one day my parents got a letter from my music master! And it said

"Your son has such a beautiful voice that teaching him is beyond my powers.... you would and should definitly find a better music teacher!"
and so on.........
that is what my mother said to me......how ever i recently am starting to guess that he ran away from his house due to some compulsions from his neighbours regarding his music class and i was his dear disciple! LOL! my god , my first music teacher ran away trying to teach me music........my parents decided not to send me to any music class from here after..........

well well! that explains why i dont know karnatic music........ but that doesnt mean i cannot sing ! well if you wanna hear mine you can surely write to me and i shall show you! :p

Friday, March 24, 2006

Cd Rom Busted

Well i hate this computer drives when they malfunction and mine does toooo! i have a cd writer/dvd reader which got busted for no reasons! now it is not reading any free space on my cd's and it is not writin either! damn cd rom i am so pissed off!