Computer Science Canada

Google CodeJam

Author:  jernst [ Tue Jun 24, 2008 2:28 pm ]
Post subject:  Google CodeJam

Was browsing around today and came across this coding contest put on by google. It has some prize money and such if you really do well so I thought some people here might be interested.

http://code.google.com/codejam/

Author:  apomb [ Tue Jun 24, 2008 2:35 pm ]
Post subject:  RE:Google CodeJam

wow... anyone who places within the top 100 wins money... not bad.

Author:  jernst [ Tue Jun 24, 2008 2:39 pm ]
Post subject:  Re: Google CodeJam

yeah pretty cool, also seems like they are sorta using it for recruitment as well, because in the sign-up process it asks if they can contact you for employment...so thats kinda more motivation if your interested in working for them

Author:  apomb [ Tue Jun 24, 2008 2:41 pm ]
Post subject:  RE:Google CodeJam

Thats a pretty bold statement. Personally, though, I will not be entering. good opportunity for some of the better programmers here though.

Author:  jernst [ Tue Jun 24, 2008 2:54 pm ]
Post subject:  Re: Google CodeJam

yeah im not expecting to do well, but should be fun anyway haha Razz havent done a contest since high school

Author:  Aziz [ Tue Jun 24, 2008 3:00 pm ]
Post subject:  RE:Google CodeJam

We should sponsor someone to do it Very Happy and then donate the prize money to me/compsci.ca.....

Author:  Zeroth [ Tue Jun 24, 2008 6:53 pm ]
Post subject:  Re: Google CodeJam

I finished the first practice problem in... 3 hours. but I got it right! Working on the second one... they are solvable, and great practice for all.

Author:  zylum [ Tue Jun 24, 2008 7:30 pm ]
Post subject:  RE:Google CodeJam

If you don't do algorithm contests frequently, it will be rather difficult to finish in the top 100.. Here at compsci.ca you might expect members such as klopyrev and bugzpodder and maybe one or two more. I personally haven't done programming contests for a few years but might do this one for fun and to see if I can perform as well as I did in the past (which was not so well mind you).

Author:  StealthArcher [ Tue Jun 24, 2008 7:32 pm ]
Post subject:  RE:Google CodeJam

Tony might do okay. Maybe. Possibly, prolly, could be.

Author:  SJ [ Wed Jul 16, 2008 4:01 pm ]
Post subject:  Re: Google CodeJam

I was just reading the rules and the 4th point said

"You are eligible if you meet the following requirements at the time of registration...
You are not a national or resident of any of the following countries or provinces: Burma (Myanmar), Cuba, Iran, North Korea, Quebec, Sudan and Syria, or anywhere where the contest is prohibited by law."

Quebec? French Canadians can't participate in code jam. haha

Author:  Zeroth [ Wed Jul 16, 2008 5:11 pm ]
Post subject:  Re: Google CodeJam

Labor laws.

Author:  gitoxa [ Wed Jul 16, 2008 7:38 pm ]
Post subject:  RE:Google CodeJam

If you ever look at the rules of any North American contest, Quebecois aren't eligible to win prizes either.

I'll be picky here and say french Canadians are allowed, just as long as they don't live in Quebec. Razz

Author:  Zeroth [ Wed Jul 16, 2008 11:25 pm ]
Post subject:  Re: Google CodeJam

I think its because of the language laws. The contests are not available in French, and entries are not accepted in french, so they are not eligible to win prizes.

Author:  aramadia [ Thu Jul 17, 2008 6:35 pm ]
Post subject:  Re: Google CodeJam

Awesome, I just heard about it in one of those google ads. I managed to get a perfect score but I took too long so I was ranked 69. Very Happy I think Klopyrev came 20th. The first two problems were greedy, but did anyone solve the third problem without using calculus?

Author:  SJ [ Thu Jul 17, 2008 6:58 pm ]
Post subject:  RE:Google CodeJam

i got the first 2.. died on the third one.. had no idea how to do it (im taking gr12 calculus next year =[ )

Author:  Tony [ Thu Jul 17, 2008 7:15 pm ]
Post subject:  RE:Google CodeJam

I'm actually more curious in your calculus approach than otherwise. How'd you construct the formula?

Author:  uncompetence [ Thu Jul 17, 2008 10:33 pm ]
Post subject:  Re: Google CodeJam

Being the honest person that I am, I signed myself up at being under 18. I think there was a rule there that we're not allowed to progress to the next round if we're under 18. Any chance they'll be nice or that I could do a quick profile change to move on? For me, it was a pretty fun qualifier, I didn't really rush to finish. I sat watching TV on one monitor and slowly typing away on the other. Finished the first two, didn't bother with the last =\.

Author:  jeffgreco13 [ Fri Jul 18, 2008 8:27 am ]
Post subject:  Re: Google CodeJam

I'm pretty sure only the top 500 get to travel to the locations specified...
if u just 'didnt' do the last one im pretty sure u wont be in that 500

Author:  Zeroth [ Fri Jul 18, 2008 8:44 am ]
Post subject:  Re: Google CodeJam

Mmm, I tried to do number one, but got number two, but it looks like there was an error in my input file. Sad So I didn't make it to round 1

Author:  aramadia [ Fri Jul 18, 2008 11:05 am ]
Post subject:  Re: Google CodeJam

Spoilers for Question 3!

The probability of the fly not being hit by the racket is the area of the "gaps" divided by the area of the total racket. To make it easier, assume the fly is a point and make the gap size smaller by the fly's radius (around the edges). Also notice the racket is symmetrical so you only need to calculate one quarter of the area and then multiply of by four (I picked the SE quarter). So the only hard part is to calculate the area where the ring intersects the gaps. In the end loop through all the gaps and check if the the square intersects the ring. If it does calculate the area lost due to the circle. You can integrate the equation (x-h)^2 + (y-k)^2 = R^2 using mathematica or if your lazy I just approximated it with 10000 rectangles. There are a lot of annoying parts so it helps to draw out all possible ways the circle can intersect a square (there are four in this case).

It's fast enough and it gives you an accurate answer. Only problem is calculus is rarely used in programming contests. I'm guessing another way is to actually simulate a million trials to get the final probability.

Author:  jeffgreco13 [ Fri Jul 18, 2008 1:32 pm ]
Post subject:  Re: Google CodeJam

So how are our participants doing?? Is anyone in the top 500 as of right now

Author:  jernst [ Fri Jul 18, 2008 7:42 pm ]
Post subject:  Re: Google CodeJam

bah i forgot all about the darn thing and i made a post about it earlier Sad stupid homework and work eating all my time lol

Author:  klopyrev [ Sun Jul 20, 2008 6:59 pm ]
Post subject:  Re: Google CodeJam

There is a fairly simple way to solve #3 using only simple geometry(area of a triangle) and basic trig(area of a sector, angle between 2 vectors). The code for that is really short. Like the calculus solution, you have to consider every gap and count how much area is inside the circle and that gap.

Author:  thegoose [ Mon Jul 21, 2008 12:18 am ]
Post subject:  Re: Google CodeJam

klopyrev @ Sun Jul 20, 2008 7:59 pm wrote:
There is a fairly simple way to solve #3 using only simple geometry(area of a triangle) and basic trig(area of a sector, angle between 2 vectors). The code for that is really short. Like the calculus solution, you have to consider every gap and count how much area is inside the circle and that gap.


Most contest geometry problems tend to boil down to cross-producting and angle chasing. Also, geo code tend to be short, but extremely dense. You can do some pretty horrendous things in 20-40 lines. (Case and point: Tor's N^2 code to CCC08 Landing was 30 lines, excluding comments)

Author:  bugzpodder [ Thu Jul 24, 2008 4:57 pm ]
Post subject:  Re: Google CodeJam

meh, I am interning with them I didn't go participate


: