Login | Register

Nerd Paradise

Don't blink.
The Forum > Technology > NP Python Olympiad
Page: 1 2 3 Next >
A real-time 2-hour Python competition.

No prizes (yet), just for fun. Probably following the ACM style of college programming competitions
  • 10 problems
  • Problems are usually in the format of "take such and such input from standard input, and generate such and such from that and send it to standard output". Basically raw_input and print.
  • Winner is the one that solves the most problems within the time limit.

Like the old Ninja Coder, except the winner is based on speed and not code length.

I just want to gauge some interest before I go through the trouble of putting together an auto-grader.
[Quote] [Link]
I would love to do this, though I would probably not do very well yet.
[Quote] [Link]
2 hours eh?

I can't guarantee I'll participate. I might have work. But if I'm off, YOU'RE ON! D:<
[Quote] [Link]
Maybe, depends on if I'm doing something at the time (be it very deeply involved in a videogame or school or work...), but it sounds interesting.
[Quote] [Link]
I (still) can't code to save my life, so I'm out. Sorry.
[Quote] [Link]
I'd give it a shot. My Python skills (what I had of them) have rather atrophied, but this may be just the thing to get me back into it.
[Quote] [Link]
*cries*
I would love to but the only python stuff i know is the things you had in your tutorial and the thing that i'm doing on my own. Which only has a few simple easy commands.
[Quote] [Link]
I will still do this if people are interested. Most of the people who posted in this thread are now gone or lurkers.
[Quote] [Link]
I have been gifted with a few hours of spare time this weekend. I will use this to write the autograder I mentioned in the original post. Would anyone be interested in participating a dry run/beta test this Sunday at noon PDT?

(also, I'm cross-listing this thread on TwoCans in case there's any interest there)
[Quote] [Link]
Maybe eventually. But I only have time to write one auto-grader right now.
[Quote] [Link]
Why would the auto-grader be hard to write? It just needs to run Python code and check output, right?
[Quote] [Link]
That's the easy part. The difficult part is sandboxing the process in a light-weight fashion. The other time-consuming part is writing the real-time scoreboard and the hooking up the website to the sand-boxed auto-grader.
[Quote] [Link]
Can it be in alternate implementations, like CLPython?
[Quote] [Link]
I'm in for Sunday at noon PDT. :)
[Quote] [Link]
Cosman246 said:
Can it be in alternate implementations, like CLPython?


As long as the code runs as-is on normal Python 2.x/3.x
[Quote] [Link]
My skills have gotten a tad rusty, but I'll want to participate.
[Quote] [Link]
I'll be there!

How will submission work?
[Quote] [Link]
It'll be a web form. Either code pasting or uploading a file.
[Quote] [Link]
Neat! I haven't participated in a programming contest in quite a while, so I'm getting excited about this.
[Quote] [Link]
I guess I'll explain the rules now...

I will be adapting the ACM College Programming Competition style/rules or at least the parts that I remember.

There will be three web pages that I will give you the URL's for. One will be a scoreboard listing everyone who is participating. One will be your current score. The other will be a list of 10 coding problems (links to problems. each problem will have its own page).

The coding problem pages will have a prompt, some sample input of what your program should accept, and the sample output for that particular input. Below will be a submission form. From there you will paste your code and select whether it runs on 2.7 or 3.1. And then there will be a send button.

Your scoreboard page will show you all 10 problems and what your current status is on each. When you submit a problem, this is the page that you will check to see if you completed it successfully. When you submit a problem, the auto-grader will pick up your code and run it against an unknown input. Not the one that was the sample input. The actual test data will probably be a much larger size than the sample data. The status for each problem will be one of the following:
  • Unsolved (all problems start in this state)
  • Correct
  • Queuing
  • Running
  • Syntax Error
  • Takes too long
  • Incorrect Output
No debug information will be returned. It is up to you to figure out why your program failed.

The scoreboard for all players will just be a list of names with colored dots next to each. Each color represents a different problem. You will not know which color represents which.

The problems will range in difficulty. Some will be really easy. Some will be not so easy. If you notice that everyone has the blue dot, yellow dot, and brown dot, and you only have the lavender dot, that means you probably started with a hard problem. You can do the problems in any order you want.

Scoring

The person who solves the most problems wins. Plain and simple. No extra credit for solving hard problems vs solving easy problems. When you solve a problem, the time is recorded that you sent in your final submission for the code. The sum of the time it took you to solve all your correct problems is added together. This is called a penalty score. When you make a submission that is not correct, you will get additional penalty points equivalent to 10 minutes of unsolved time. This penalty score is used ONLY for tie-breakers between people that have correctly solved the same number of problems.
  • If a person solves 6 problems nearly instantly and solves no more for the rest of the time, he will lose against someone who solves 7 problems with a billion penalty points.
  • If a person solves just 1 problem in 30 minutes, he will lose against someone who solves just 1 problem in 29 minutes if both of their first submissions were correct.
  • If a person solves just 1 problem in 11 minutes (but made 2 incorrect submissions before finally getting it correct), he will lose against someone who solved the problem in 30 minutes but made only 1 correct submission.

The competition lasts 2 hours.
[Quote] [Link]
Here's some boiler plate code and a preview of how the problems will be written.

Practice Problem #0 - Double

Write a Python program that takes in a list of numbers from standard input. These numbers will each appear on their own lines. Your program must double these numbers and print them each on a line to standard output.

Sample Input


5
7
3
8
1053


Sample Output


10
14
6
16
2106


Below is an example of a correct answer. It is heavily commented. I'd be slightly concerned if you heavily commented yours to this degree. You are free to copy and modify this code for your own submissions.

# loop through lines that come in from standard input
while True:
    
    # take a line from standard input
    # In Python 2.x, use raw_input()
    # In Python 3.x, use input()
    # They are both the same function. Just different names.
    # Like "Hardees" and "Carls Jr."
    line = raw_input()
    
    # if the line is blank, you're done! there are no more lines.
    # ALL input will be terminated with a blank line
    if not line:
        break
    
    # if there is a line of input, then do whatever it is you need to do.
    # In this case, we are doubling the value. 
    
    num = int(line)
    answer = num * 2
    
    # to send something to "standard output", just print it
    # print includes a line break at the end of the string you provide.
    # conversely, you can print all your output at once and include the \n's yourself
    
    # remember, for Python 3.x, print statements require parenthesis 
    # around the item you are printing
    print answer
    
    # another useful tip may be to build a list of all the lines 
    # before doing your computation. This may be better for certain
    # types of problems. 


Testing your code:

  • Make a file called whatever.py.
  • Make a file called whatever.txt.
  • Paste the contents of the sample input into whatever.txt.
  • Write your code in whatever.py.
  • Open up a command line.
  • Navigate to this folder that has these two files in it.
  • Run python whatever.py < whatever.txt
  • If you see the sample output as a result, then you are good to go.
  • Copy your code in whatever.py and paste it into the submission form.
  • The autograder will pick up your code and run it with a DIFFERENT sample data set that will be unknown to you to make sure you're not just printing the sample output like a wiley fox.
  • The status of the auto-grader will be displayed on your scoreboard.

  • If you get an EOF exception while running this code, you need to add another blank line to the end of your file. If you are annoyed by this, you can add a try+except+break. It won't harm your submission to have the extra check. Just make sure you ignore blank lines.

If you are planning on participating, it's probably a good idea to just run through the bullet points up until the submitting process before the contest starts just to make sure you're all set up.

And here it is
[Quote] [Link]
Page: 1 2 3 Next >
The Forum > Technology > NP Python Olympiad
Current Date: 13 Ineo 10:2Current Time: 9.80.57Join us in IRC...
Server: irc.esper.net
Channel: #nerdparadise
Your IP: 54.242.188.217Browser: UnknownBrowser Version: 0