Life In 19x19
http://lifein19x19.com/

Google Code Jam
http://lifein19x19.com/viewtopic.php?f=8&t=5819
Page 3 of 6

Author:  Kirby [ Sat Apr 08, 2017 7:29 pm ]
Post subject:  Re: Google Code Jam

Shaddy wrote:
How'd everyone do?

I missed D-large.


I still didn't submit any other problems, other than what I already did last night (Tidy Numbers Small/Large + Bathroom Stalls Small).

Kids just went to bed, though, so I will see if I can solve some of the other ones tonight.

My only other goal for the night is to do taxes, and that shouldn't take too long :-p

Author:  Shaddy [ Sat Apr 08, 2017 7:32 pm ]
Post subject:  Re: Google Code Jam

Solomon wrote:
Failed on 2 larges unfortunately, but still managed to advance to R1 w/ 35 points. It was fun! Hopefully I can advance to Round 2 through Round 1C, which I heard is the easiest since 2000 of the 3000 who would have advanced already go through, and it's at a weird time for anyone outside the US (2am PST). Good job on getting half of D Shaddy!

Urgh. I just read the solution, and I feel silly now. There's always next round..

Author:  gamesorry [ Sat Apr 08, 2017 7:55 pm ]
Post subject:  Re: Google Code Jam

Solomon wrote:
Failed on 2 larges unfortunately, but still managed to advance to R1 w/ 35 points. It was fun! Hopefully I can advance to Round 2 through Round 1C, which I heard is the easiest since 2000 of the 3000 who would have advanced already go through, and it's at a weird time for anyone outside the US (2am PST). Good job on getting half of D Shaddy!


I also advance to R1 w/ 35 points from the first two problems. I'll probably try Round 1A because the other two don't match my schedule well :sad:

Author:  Kirby [ Sat Apr 08, 2017 9:00 pm ]
Post subject:  Re: Google Code Jam

I guess in the next round, we have to be fast, since there's a cut off. Personally I think that participating at a fitting schedule trumps playing at a less popular time.

Solving problems at 2am is a lot harder than during the day.

Author:  HermanHiddema [ Sat Apr 08, 2017 11:56 pm ]
Post subject:  Re: Google Code Jam

As expected, I didn't get around to doing problem 4. Got home at 2am and preferred sleep over making a last ditch 2 hour effort :)

Problem 4 sounded like a variation of the 8 queens problem. I might have a go at it for fun if I can find the time.

Anyway, I advance with 65 pts from the first 3.

Author:  hyperpape [ Sun Apr 09, 2017 5:45 am ]
Post subject:  Re: Google Code Jam

Ugh. I never ended up getting Bathroom Stalls, after spending about 3 hours working on it. My approach is roughly the same as the one in the analysis for the large one, but I have a bug that I was never able to track down. My answer gave me the right answers on every case that I was able to check, but was wrong on something else. I'll have to download solutions/someone else's code and find out which cases I'm answering wrong.

So I ended up with 20 points for answering Tidy Numbers.

One observation if I do this again: I spent more time fighting with maven and intellij than the top contestants spent solving any individual problem (it alternately wanted to compile using Java 1.5 and then refused to import JUnit for testing for reasons I don't understand).

Author:  HermanHiddema [ Sun Apr 09, 2017 11:36 am ]
Post subject:  Re: Google Code Jam

@hyperpape: I had a subtle off-by-one on my first implementation of bathroom stalls. I don't know if you're running into the same problem, but if you are, here are some cases I got wrong first time round: 500 stalls 117 people, 500 stalls 245 people and 1000 stalls 489 people

Author:  Kirby [ Sun Apr 09, 2017 11:56 am ]
Post subject:  Re: Google Code Jam

FWIW, checking every single empty bathroom stall and calculating distance from other stalls every single time still works fast enough to get the 5 points for the small problem set. I did this on Friday when I couldn't think of a good efficient implementation.

Author:  Solomon [ Sun Apr 09, 2017 6:00 pm ]
Post subject:  Re: Google Code Jam

Kirby wrote:
I guess in the next round, we have to be fast, since there's a cut off. Personally I think that participating at a fitting schedule trumps playing at a less popular time.

Solving problems at 2am is a lot harder than during the day.
Oh, I'll certainly try my best in 1A and 1B as well which start at reasonable times (especially since I get Friday off, and 1A is on then). I'm just not too optimistic about getting through for those seeing past contest results. Plus I already wake up early every day (4am), so shifting it two hours behind for 1C shouldn't be too bad ;-).

Author:  Kirby [ Sun Apr 09, 2017 7:42 pm ]
Post subject:  Re: Google Code Jam

Solomon wrote:
Plus I already wake up early every day (4am), so shifting it two hours behind for 1C shouldn't be too bad ;-).


Wow, I guess you can at least beat the traffic :-p

Author:  Kirby [ Mon Apr 10, 2017 4:02 pm ]
Post subject:  Re: Google Code Jam

I got the email for Round 1 today, and it says that "collaboration is strictly prohibited in Round 1".

So I guess we should hold off on commenting on any problems until after 1C.

Author:  Shaddy [ Mon Apr 10, 2017 4:38 pm ]
Post subject:  Re: Google Code Jam

It's funny that collaboration wasn't banned in the qualification round. By the way, what's everyone's nick on code jam? I'm shadonra on there.

Author:  Solomon [ Mon Apr 10, 2017 5:27 pm ]
Post subject:  Re: Google Code Jam

L19 (GCJ)
  • apetresc (apetresc)
  • gamesorry (SuperRabbit)
  • HermanHiddema (herminator)
  • hyperpape (hyperpape)
  • Kirby (Kirby)
  • Shaddy (shadonra)
  • Solomon (tesuji)

Author:  jeromie [ Mon Apr 10, 2017 7:24 pm ]
Post subject:  Re: Google Code Jam

I haven't been around here much lately, but I am doing the code jam. I only got 25 points in the first round, but at least I get to move onto the second.

I actually had an O(1) solution for the bathroom stalls problem--I figured out how to solve the problem mathematically--but I failed the large set because my solution relied on floor / ceiling functions and I forgot to take into account that I would lose the least significant digits with numbers as large as 10**18.

I'm jeromie on Google as well as here. :-)

Author:  Kirby [ Tue Apr 11, 2017 2:22 pm ]
Post subject:  Re: Google Code Jam

Since Shaddy did pretty well, I compared some of the source files I submitted to the ones that he submitted (I hope you don't mind, Shaddy - I only compared since you did a pretty good job).

Aside from simply being better at solving problems :-), here are some differences I noticed, which maybe I should learn from to become a better programmer:

1.) My source code is much more verbose. Just comparing 'TidyNumbers', my source code is about twice as long. I have several more spaces, some unnecessary functions, and I use much longer variable names.

2.) Not a huge deal, but the logic I had for reading from and out to files was unnecessary. I like the idea of just using stdin and stdout - it cuts the program down to what's necessary to solve the problem.

3.) My approach to solving the problem appears to be less direct. I start typing out a high level outline of what I think needs to happen, and then when I get a little stuck, maybe I throw in a function call to solve that subproblem later. In contrast, it would be nicer to directly think of what needs to happen algorithmically right at the moment that I'm solving the problem.

Maybe it's easiest to say that I need to be more concise, and directly solve the problem. But perhaps this is just due to the fact that I didn't solve the problem entirely in my head before I sat down and started typing. It might come down to just being better at problem solving.

On the other hand, aiming to be more concise in presentation (shorter variable names, less spacing, etc.) is something that's easy to fix.

I'll try to work on these things for Round 1, assuming I'll be able to participate at the scheduled times. So far the best option seems to be Round 1A, although, it would be nicer if it were scheduled a couple of hours later.

Author:  Solomon [ Tue Apr 11, 2017 2:44 pm ]
Post subject:  Re: Google Code Jam

Kirby wrote:
On the other hand, aiming to be more concise in presentation (shorter variable names, less spacing, etc.) is something that's easy to fix.
True, but you could also be that one guy (literally one guy) who wrote their solution in LOLCODE (anonimous's Tidy Numbers, passed both small and large):
Code:
HAI 1.4
    CAN HAS STDIO?

    HOW IZ I CHECKDESCENDING YR NUM
        I HAS A LAST ITZ 10
        I HAS A TN
        TN R NUM
        I HAS A TTN

        IM IN YR DESCLOOP UPPIN YR EYE WILE DIFFRINT TN AN 0
            TTN R MOD OF TN AN 10
            BOTH SAEM BIGGR OF LAST AN TTN AN LAST, O RLY?
                YA RLY
                    TN R QUOSHUNT OF TN AN 10
                    LAST R TTN
                NO WAI
                    FOUND YR FAIL
            OIC
        IM OUTTA YR DESCLOOP

        FOUND YR WIN
    IF U SAY SO

    HOW IZ I TIDYING YR NUM
        I HAS A DESC ITZ A TROOF
        DESC R I IZ CHECKDESCENDING YR NUM MKAY

        IM IN YR TIDYINGLP UPPIN YR EYE WILE BOTH SAEM DESC AN FAIL
            NUM R DIFF OF NUM AN 1
            DESC R I IZ CHECKDESCENDING YR NUM MKAY
        IM OUTTA YR TIDYINGLP

        FOUND YR NUM
    IF U SAY SO

    I HAS A NUMINP
    I HAS A CURINP
    I HAS A EYE ITZ 0
    GIMMEH NUMINP
   
    NUMINP IS NOW A NUMBR
    IM IN YR CIRCLEZ UPPIN YR EYE TIL BOTH SAEM EYE AN NUMINP
        GIMMEH CURINP
        CURINP IS NOW A NUMBR
        VISIBLE SMOOSH "Case #" AN SUM OF EYE AN 1 AN ":: " AN I IZ TIDYING YR CURINP MKAY MKAY
    IM OUTTA YR CIRCLEZ 
KTHXBYE

Author:  Kirby [ Tue Apr 11, 2017 2:50 pm ]
Post subject:  Re: Google Code Jam

Solomon wrote:
True, but you could also be that one guy (literally one guy) who wrote their solution in LOLCODE


Haha... Gotta say, I think I don't mind not being that guy :-)

Author:  Shaddy [ Tue Apr 11, 2017 3:35 pm ]
Post subject:  Re: Google Code Jam

Kirby wrote:
Since Shaddy did pretty well, I compared some of the source files I submitted to the ones that he submitted (I hope you don't mind, Shaddy - I only compared since you did a pretty good job).

Aside from simply being better at solving problems :-), here are some differences I noticed, which maybe I should learn from to become a better programmer:

1.) My source code is much more verbose. Just comparing 'TidyNumbers', my source code is about twice as long. I have several more spaces, some unnecessary functions, and I use much longer variable names.

2.) Not a huge deal, but the logic I had for reading from and out to files was unnecessary. I like the idea of just using stdin and stdout - it cuts the program down to what's necessary to solve the problem.

3.) My approach to solving the problem appears to be less direct. I start typing out a high level outline of what I think needs to happen, and then when I get a little stuck, maybe I throw in a function call to solve that subproblem later. In contrast, it would be nicer to directly think of what needs to happen algorithmically right at the moment that I'm solving the problem.

Maybe it's easiest to say that I need to be more concise, and directly solve the problem. But perhaps this is just due to the fact that I didn't solve the problem entirely in my head before I sat down and started typing. It might come down to just being better at problem solving.

On the other hand, aiming to be more concise in presentation (shorter variable names, less spacing, etc.) is something that's easy to fix.

I'll try to work on these things for Round 1, assuming I'll be able to participate at the scheduled times. So far the best option seems to be Round 1A, although, it would be nicer if it were scheduled a couple of hours later.

My source code isn't verbose because I'm writing code in mostly unaugmented vim and it's annoying to type out long variable names. I would try to use more descriptive variable names if typing them out were faster somehow. Most of the difference is probably just about solving the problem entirely before writing the code.

Author:  Shaddy [ Tue Apr 11, 2017 3:48 pm ]
Post subject:  Re: Google Code Jam

I read your Tidy Numbers and now I really feel silly. The way I did it was a little too tricky and there were bugs in my initial implementation - yours is much easier to write.

Author:  Kirby [ Tue Apr 11, 2017 4:50 pm ]
Post subject:  Re: Google Code Jam

Quote:
Most of the difference is probably just about solving the problem entirely before writing the code.


Yes, this!

Strikingly similar to playing go, eh?

Page 3 of 6 All times are UTC - 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/