Showing posts with label codechef. Show all posts
Showing posts with label codechef. Show all posts

Tuesday, 21 October 2014

ACM !

So, its official now . My team got selected for ICPC onsite regional of Amritapuri !

Though, our performance was very bad but we got selected as we were the best team in our college.
We would like to make a mark in our first ever regional . Lets see what happens in the coding arena .

These days I'm learning and coding as much as I can . Expanding my armory with new techniques ranging from geometry to DP ,from bits to graphs.

After a long time I participated in a timed contest on codechef and stood 852 out of around 2500 contestants . Not one of my best but still good enough for a start after a very long time .

Yesterday I solved a question based on breadth first search and it felt so great after solving that as it was my first bfs problem . I was waiting for this for a long time .

Thanks for reading and keep coding !

Sunday, 14 September 2014

Ups and downs again .

This week was not very good but still I learned a lot . Not very good because I didn't rise up in terms of ratings and scores but good as I still learned may new things , things which can only be learnt through failures after all a monotonously increasing graph is really 'monotonous' .

1. I couldn't solve a single question in the Codechef's long contest .(I just can't believe it,I think I didn't try much harder).
2. My last 2 matches on codeforces were not so good as my rating decreased heavily .
But at the end of the week.
My team got selected for Codesprint contest (National contest) and we solved all the questions given and in that I played a major role in solving 2 toughest questions(only 1 was a little bit trickier the other was easy).

Life is so much funny, sometimes you fall down sometimes you rise like anything.

I care less for results and more for actual learning because results are the outputs and if you don't give some input how will you get output ?

My mid semester Examinations are coming next week . So, I'll be taking a short break from programming because academics are also necessary .

Thanks for reading . Keep learning . Keep coding . 

Sunday, 31 August 2014

One more great week !

This week was very good in terms of my ratings in the various online contests. 

For the first time I solved 3 Div 2 problems in a codeforces round and now I am at my all time highest rating of 1457 . I solved a question in SRM also and now my rating is above my past 4 months record . 
We solved 1 question in TCS codevita too .  
Today I solved a problem in Codechef's Lunchtime too.

This weekend I was developing a GUI in python using tkinter . I made a simple quiz with some options as buttons on it .Clicking on the buttons displays comment(Label) on your selection in a funny manner . I'll add some more features to it in the coming weeks .  

We are planning to take part in ICPC online rounds as the first team from our college . Lets see what we'll be able to do . 

Thanks for reading . 

Sunday, 24 August 2014

In love with codes

These days I am truly enjoying programming . Learning new & exciting techniques/algorithms .

Now,I've started challenging  my friends to see who is better at competitive programming . This week I participated in codeforces Div2 round and solved 1 problem but I lost to my friend Sudharsan who got it correct in first go and that too within 14 minutes , that's very impressive start but I don't like to lose much and I'll come back strong .

These days I am solving problems on codeforces .

Surprisingly we(me & Sudharsan) got selected for round 2 of TCS coding contest and will try to best in the second round as we couldn't do well in our first round .

Last night I was solving a problem which required factors of a no. to be calculated first . I was thinking of searching the method on the net but then I decided that I'll try it out myself first . I came with an idea and it worked

Suppose we want to calculate factors of N (including 1 & N itself)
for(i=1;i<=sqrt(N);i++)
{
     if(i*(N/i)==N)
    {  
        printf("%d",i);
        if(i!=N/i)
        printf("%d",i);
     }
}
This will print all the factors of N . If statement is included to avoid repetition of 1 if we write N = 1.

Today I've challenged my friends in Codechef's Cook off . Lets see who wins . Waiting for the round to commence .

Thanks for reading and keep coding .

Monday, 11 August 2014

Exciting week !

This week was full of ups and downs (I like it ;) ). I started practicing div 2 500 problems on TopCoder but after 2 days I was having loads of academic work pending and unfortunatley I had to give up my idea of solving 3 problems a day . But I didn't stop coding . Everyday I was learning new & exciting stuffs . I started learning python and C++ (OOPS part) I fell ill also(Now I am fit) .

One of my batch mate  asked me about the working of the square root function I told him that it should behave like a standard function with some iteration by which it outputs the answer to a particular level of precision and then while learning python I came across Newton Raphson method to calculate square root of a given number . I was very excited to see such method .Its like -

suppose we want to calculate the sqrt of N -
1. Take a rough approximation of lets say x = N/2 (It can be taken anything but it is advised to make it close to the square root of N)
2.  Iterate -
                 y = (x + N/x)/2
                 x = y
3. stop iterating when you reach to a particular level of precision lets say 0.00001

 sqrt(N)
{
     x = N/2
     while(1)
    {  y = (x+N/x)/2
        if(abs(y-x)<0.00001)break
        x = y
    }
   return x
}
Wondering whether if this is the method behind the built in function sqrt ... Gonna search for it .

Yesterday, I gave an online contest on Codechef which was conducted by IIIT Delhi's programming club and got 362nd rank .. All questions were easy but I could solve only 2/5 due to lack of Algorithmic knowledge .

Thanks for reading and keep coding !

Monday, 4 August 2014

Practice Session

So, once again I am shifting to TopCoder to hone my programming skills .This time I am doing Div 2 500 problems . I am forming a team to apply for ICPC regionals . First ,we need to qualify for the onsite regional contest and if we are able to do that it will be great as we are just in our 2nd year and with very less experience in programming . Lets see what happens.

This week I was doing random problems and participated in Codechef's Long contest which is still going on . I've already done 2 problems in the contest .I am participating in Codevita also which will be conducted on Aug. 12.
I've written a C++ program for BFS and will try to apply it on some graph problems .  

Thanks for reading . 

Sunday, 27 July 2014

Lucky Start in new semester

I reached hostel on 20th July afternoon. After taking rest for sometime I was ready for the Codechef's Cook Off contest . I started off well by submitting the first problem in the 7th minute . That was a very simple problem,  after that I attempted one more easy problem but made a very simple mistake and got penalized for that . Penalty was 20 extra minutes in my actual time . It was very frustrating that in an easy problem I missed one small condition and straight away I was penalized heavily for that but after one wrong attempt I submitted it successfully . Luckily I completed all the problems that were within my reach in time as just after submitting the second problem current went off .
I got 454th rank overall in the contest.

This week I was doing problems randomly as I was busy getting prepared to attend the classes and adjusting in a new room .
I did a problem on floating numbers and got a tip from a senior while doing it from a senior that if we enter a floating no. from the user like 0.02 it gets stored in the memory as 0.0199999999...(you can't see it as while printing the no. it shows 0.02 only ) while converting the decimal parts in binary the precision is not infinite so these things happen and thus a bug may easily enter our 'bug free looking' program .So,its advisable to use string to take the no. from the user and then manipulate it accordingly .
 
I've made a time table for myself I hope it will help me to manage my time properly . I know that managing programming and studies will going to be a challenging task for me but I'll try my best.

Thanks for reading and keep coding. 

Monday, 21 July 2014

New semester new story.

My 3rd semester is just about to start within a day from now.I'll try my best to make full use of time and the resources I have in this semester.
Just last night I participated in Codechef's Cook Off and did 2/5 problems . These two problems were very easy the other three were somewhat difficult out of those 3 two were touching the concepts of graph theory.
I made a wrong submission that costed me a penalty of 20 mins. otherwise I would have been in under 300 for sure but still I got 453 rank.

I got a method to calculate both LCM and HCF and that too very fast O(LogN). Yes,if you know it already I am talking about Euclid's GCD theorem.

Its like this -
Lets say we want to calculate GCD(Greatest Common Divisor or Highest Common Factor) of two given numbers lets say A,B .

So, pseudo code of the algorithm looks like this -
START-
GCD(A,B):
    if B>A return GCD(B,A)
    else:
        if A%B==0 return B
        else return GCD(B,A%B)
END
For example lets say A=12,B=18
calling GCD(12,18)
so as B>A it returns GCD(18,12)
then as 18%12=6 which is not equal to 0 it returns GCD(12,6)
but now as 12%6=0 it finally returns 6 . So, 6 is the GCD of 12,18

This method is very old yet very effective method to calculate the Highest Common Factor of given two numbers.

Now to calculate LCM all we need to do is just multiplay the no. A & B and divide the product with the GCD of A & B.
For example lets say A=12,B=18
So, LCM of 12,18 will be 12*18/GCD(12,18) = 12*18/6 = 36
Time Complexity of this algorithm is also O(LogN) as multiplication is O(1) and GCD is O(LogN)
So,Now we have two very effective algorithms to calculate HCF,LCM of two numbers .

Thanks for reading and Happy Coding :) .

Thursday, 12 June 2014

Couldn't stop to participate

Earlier I was thinking that I will not participate in any kind of competitions but I couldn't stop myself ....
Participated in the SRM 624 and guess what ? I submitted 2 div2 problems successfully a 250 & a 500 finishing at 8th place in my room 'my current best' previous best was 10th . Got 246 odd pts from the 250 pointer I think this is my best till now. 
The problems were very easy in this SRM that's why I could solve them(This is the truth).

I participated in Codechef's June Long contest also and solved 2 problems for the first time in a long contest.
So, definitely I am improving day by day I should not give practicing because practice is the key to get better at almost everything and coding competitions are no different.