Codechef

This is a discussion on Codechef within the General Discussions forums, part of the Community Boards category; I don't know how many of you are aware of this, but CodeChef - Online Programming Competition organizes an algorithm ...

  1. #1
    Registered User
    Join Date
    Nov 2004
    Location
    India
    Posts
    515

    Codechef

    I don't know how many of you are aware of this, but CodeChef - Online Programming Competition organizes an algorithm intensive programming competition extending over about 10-15 days every month. The next competition is coming up on the 1st of July and will go on till the 13th. As of now, only Indian and US citizens are eligible for prizes, but people from other countries are welcome to participate too Currently they are using SPOJ's(Sphere Online Judge (SPOJ)) systems as the judge. The quality of problems is pretty nice as well. They have about $3000 worth of prizes going out this time round. Hope to see you all there
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

  2. #2
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,831
    Interesting. I like the finding the next higher palindrome one. But I don't think I'm understanding the problem correctly. I'm sure my algorithm will execute in sub-thousands of a second... Oh well. Maybe it's meant for students and not professionals.

  3. #3
    Registered User
    Join Date
    Nov 2004
    Location
    India
    Posts
    515
    Quote Originally Posted by nonoob View Post
    Interesting. I like the finding the next higher palindrome one. But I don't think I'm understanding the problem correctly. I'm sure my algorithm will execute in sub-thousands of a second... Oh well. Maybe it's meant for students and not professionals.
    You could ask for help in the forums. And no, if you see the winners for the last contest, two of the three were professionals.
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

  4. #4
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,831
    I'd love to be able to submit my code - to there or to here. But I wouldn't want people to start cheating

    Personally I think that some of these programming contests toss in problems that are dubious. One asks for entrants to submit sort algorithms. Hmmmm. Are they hoping for some breakthrough? Or perhaps they should just ask naive programmers to solve the traveling salesman problem, or other intractables. Just in the hope that there's an untapped genius solution out there. Then offer a $10 reward. Ha!

  5. #5
    Registered User
    Join Date
    Nov 2004
    Location
    India
    Posts
    515
    Well, I doubt the contests do that. Most contests have a solution ready for all the problems that they put up.
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

  6. #6
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,831
    No sense of humor.

    Anyhow... In the interest of validating my fancy-pants (TM) algorithm I also wrote a "naive" one with which to compare results. The naive one simply increments the number by 1 and retests its palindromeness until it finally hits one.

    The execution times are listed below.

    To generate next palindrome for all numbers 1 to 150,000


    naive method: 26.1 seconds
    my method: 0.1 seconds
    (Intel 3.2 GHz Xeon)

    Maybe I'll post it if I know the contest is closed. Not sure how to tell from that hard-to-navigate site. It was torture just to find the palindrome problem again.
    http://www.codechef.com/problems/PALIN/
    Last edited by nonoob; 06-29-2009 at 04:52 PM.

  7. #7
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Quote Originally Posted by nonoob View Post
    No sense of humor.

    Anyhow... In the interest of validating my fancy-pants (TM) algorithm I also wrote a "naive" one with which to compare results. The naive one simply increments the number by 1 and retests its palindromeness until it finally hits one.

    The execution times are listed below.

    To generate next palindrome for all numbers 1 to 150,000


    naive method: 26.1 seconds
    my method: 0.1 seconds
    (Intel 3.2 GHz Xeon)

    Maybe I'll post it if I know the contest is closed. Not sure how to tell from that hard-to-navigate site. It was torture just to find the palindrome problem again.
    CodeChef - Problem PALIN
    It's a practice problem, so who knows. I don't know how many trials there are in the test file; my program apparently ran for 0.66s.

  8. #8
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,831
    Oh, practice only? Alright.

    I wish they'd publish the test file / input data so that programmers can truly test their code, compare with expected results... so that they wouldn't embarrass themselves submitting entries that don't even get correct answers or run out of memory or something.

    What are they afraid of? Someone hard-coding responses into their code? That would be easy to spot.

    I wish I could know how your 0.66 seconds compares with my code.

  9. #9
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,236
    Are you guys actually reading the requirements?

    You must be able to find the next palindrome larger than K where K is a number of up to one million decimal digits. That's DIGITS, not absolute value.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  10. #10
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Quote Originally Posted by nonoob View Post
    Oh, practice only? Alright.

    I wish they'd publish the test file / input data so that programmers can truly test their code, compare with expected results... so that they wouldn't embarrass themselves submitting entries that don't even get correct answers or run out of memory or something.

    What are they afraid of? Someone hard-coding responses into their code? That would be easy to spot.

    I wish I could know how your 0.66 seconds compares with my code.
    Register and submit it and see.

    I admit to submitting early and often. Just for fun, the easy ones I don't write a file, I just type the code into the box. (Still haven't gotten one right first go though.)

  11. #11
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by brewbuck View Post
    Are you guys actually reading the requirements?

    You must be able to find the next palindrome larger than K where K is a number of up to one million decimal digits. That's DIGITS, not absolute value.

    These are the little "glitches" that can occur if you actually submit
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  12. #12
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,831
    Quote Originally Posted by brewbuck View Post
    Are you guys actually reading the requirements?

    You must be able to find the next palindrome larger than K where K is a number of up to one million decimal digits. That's DIGITS, not absolute value.
    Yes I read that. What's your point? My program can handle this if the memory can.

    Quote Originally Posted by tabstop View Post
    Register and submit it and see.

    I admit to submitting early and often. Just for fun, the easy ones I don't write a file, I just type the code into the box. (Still haven't gotten one right first go though.)
    I'd love to submit but the contest has too many restrictions. Strange compilers & operating systems I don't have, irrelevant input/output run environment that have nothing to do with the algorithm, and incomprehensible memory usage and time examples for submitted entries that are not explained. Plus I'm neither in India nor US.
    Last edited by nonoob; 06-30-2009 at 09:53 AM.

  13. #13
    Registered User Homer_Simpson's Avatar
    Join Date
    May 2009
    Posts
    22
    i won!!!!

  14. #14
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Quote Originally Posted by nonoob View Post
    Yes I read that. What's your point? My program can handle this if the memory can.


    I'd love to submit but the contest has too many restrictions. Strange compilers & operating systems I don't have, irrelevant input/output run environment that have nothing to do with the algorithm, and incomprehensible memory usage and time examples for submitted entries that are not explained. Plus I'm neither in India nor US.
    What? I'm not sure how "read from standard in and write to standard out" can be considered an "irrelevant input/output run environment", nor am I clear how "gcc 4" is a "strange compiler". And I'm pretty sure I've seen several people on there from outside US and India (unless I have completely lost the plot). Yes, you won't get any money, and hard luck there. On the other hand, it's not a money problem, so....

  15. #15
    Registered User
    Join Date
    Nov 2004
    Location
    India
    Posts
    515
    Quote Originally Posted by nonoob View Post
    Yes I read that. What's your point? My program can handle this if the memory can.


    I'd love to submit but the contest has too many restrictions. Strange compilers & operating systems I don't have, irrelevant input/output run environment that have nothing to do with the algorithm, and incomprehensible memory usage and time examples for submitted entries that are not explained. Plus I'm neither in India nor US.
    I don't understand why you are having so many issues with it. You just have to read the input from stdin and write the output to stdout. You can check out the FAQ under the help menu on the site for answers to your other questions.

    The compilers being used are standard and you can get them with a bit of googling. Other issues like memory usage, time limit etc. Have been dealth with in the FAQ and in the problem statement.
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21