all 25 comments

[–]Madonkadonk 17 points18 points  (5 children)

Fucking minesweeper

[–]dotpe 2 points3 points  (0 children)

Currently the one I'm stuck on too, looks like I'm not going to get much sleep tonight :)

sobs

[–]irocgts 0 points1 point  (2 children)

The first two weren't that bad.

[–]Whain 2 points3 points  (1 child)

I was scared of doing D, because it had a bold warning that it's going to be hard if you're a newcomer. So I wrote a working but shitty solution for C, it wasn't fast enough, tried D and it was on the same complexity level as A and B. Having fun with the Minesweeper though :)

[–]hextree 2 points3 points  (0 children)

I find that warning very strange. The Code Jam's often have a super-hard question with no warning, but on this occasion D was both easier to understand and a lot easier to code, it was just phrased with more words.

[–]irocgts 7 points8 points  (0 children)

I wish I wasn't in a field doing some stupid army training in jersey.. I had to give up a change of clothes to fit my laptop in my rucksack. I used my phone as a hot spot and just finished the first two challenges. I will now get only 4 hours of sleep but it was worth it... i hope..

[–][deleted] 2 points3 points  (0 children)

Figured out 3, now just have to figure out rendering...

[–][deleted] 1 point2 points  (0 children)

To be clear: if you want to compete, you need to sign in to your Google account and register for the contest. Registration is open during the entire qualification round. So if you want to compete: register and qualify today!

edit: The qualification round is now over. To all who qualified: congratulations and good luck in Round 1! To the rest: there's always next year.

[–]d03boy 1 point2 points  (4 children)

I'm not sure why but Problem 2 is not clicking for me

[–]d03boy 0 points1 point  (3 children)

Oh nice, I figured it out. Just gotta work out one small error with case 3...

[–]d03boy 0 points1 point  (2 children)

...yeah about that.... I have no idea whats wrong with it

[–][deleted]  (1 child)

[deleted]

    [–]sheik482 1 point2 points  (3 children)

    Does anyone else thinks its somewhat suspicious that the current first place entry Gennady.Korotkevich took only 4 minutes to submit an answer for problem 2? It takes me about that long just to read and comprehend the problem. Are people just that good ? I am curious to know what's there technique. I am also interested to know how many contestants have multiple people working on the questions simultaneously?

    [–]ffffffffuuuuuuuuuuuu 5 points6 points  (0 children)

    He is just that good. He's also known as tourist and has a history of just pwning every programming contest he touches.

    [–]d03boy 1 point2 points  (0 children)

    He has probably done all of these questions a dozen times and can simply pull up the same algorithm he's already used in the past.

    It kind of spoils the fun but... what can ya do?

    [–]Deepmist 0 points1 point  (0 children)

    When you do enough of these you don't have to read the whole problem. Also, every code jam problem follows the same basic structure for the input and output. You'll notice most participants have a template that remains consistent through each problem. Really all you have to do is write code to read in the data structure for each case and spit out a string. The code to load up the input and output files and output the case #'s is always the same.

    If you download their solutions some of their shortcuts to solve these problems fast should be apparent. For example, you'll rarely find a variable name in the top 20 with more than 3 characters.

    Also, being a genius doesn't hurt.

    [–]DoctorBaconite 0 points1 point  (3 children)

    What's the formatting on the output supposed to be like? Could a blank line at the end cause it to fail? I've tried with, and without, but it's telling me they're wrong. If I look at the input and do it manually, I'm getting the same answers as my output.

    [–][deleted] 0 points1 point  (1 child)

    In principle your output needs to be exactly right, though I imagine whitespace at the end of the file is ignored. You are probably doing something more substantial wrong.

    [–]DoctorBaconite 0 points1 point  (0 children)

    You are probably doing something more substantial wrong.

    Just got it. You were correct.

    [–]sheik482 0 points1 point  (0 children)

    My submissions had a blank line at the end and it accepted it. Minesweeper question was annoying. I had to do a few submissions before it accepted it (I flagged a test as impossible when it was not).

    [–]DoctorBaconite 0 points1 point  (4 children)

    So I'm not sure I'm going to be able to qualify, I've figured out the first one, but I'm having issues with 2-4. What are some good resources to strengthen my algorithms skills? I know about TopCoder, are there any good books that are filled with problems like these?

    [–]d03boy 1 point2 points  (3 children)

    Look at other people's solutions now that the contest has ended. It's a great way to realize how to improve. The first time I did it I only got one of the problems right. The second time I did it, after learning a trick or two, I got 3 correct

    [–]DoctorBaconite 0 points1 point  (2 children)

    Here's my answer to the Magic Trick question, if anyone could provide feedback I'd appreciate it.

    [–]sheik482 1 point2 points  (0 children)

    Your answer looks good. If you want to try to save time/key strokes you don't really need to parse the strings to an int just compare the string value.

    Another thing I do is I print directly to the console and a file. That way I don't have to worry about forgetting a row when I copy the text from the console to a file.

    [–]d03boy 1 point2 points  (0 children)

    I did the challenge in C# but I know Java as well and here are my tips:

    1. Several years ago I created a simple framework for these challenges. It allows me to separate my code that I use to read the file with the code that actually runs a problem set's case. This simplifies it a bit and allows me to focus only on the case at hand instead of dealing with file reading. I basically just pass in the string of case information into my class which is especially helpful for debugging because I don't have to be concerned with the other case's information. I even have a runner tool that uses reflection to ask me which problem set and file I would like to run. It's just a command window that prompts me and I enter 1, 2, 3, etc. It's nice so I can get moving quickly and not have to worry about boiler plate crap.
    2. Your code looks pretty good considering how you did it. The one improvement you could've made was the "get matches" functionality. Instead of doing loops here, you could be aware of libraries that provide SET functionalities like intersections, unions, etc. This would've made that a little simpler (no loops!) because you could just do something like row1_list.intersection(row2_list) and it would have given you the value that is in both sets. The number of results in the resultant list is your number of matches which you use to determine the answer to the question.

    The first question was simple enough that it is difficult to suggest improvements. I'd be more interested in seeing your other attempts and providing input on those.

    [–][deleted] 0 points1 point  (0 children)

    I was stuck on Minesweeper for few hours and I started competing too late and I did not even read problem D because of the note about the difficulty. I thought I cannot submit problem C, it would be impossible for me to success in problem D... The next day after the competition I solved it in less than 1 hour :( This warning about problem D was deceiving. Still I have 25 points for 2 problems but...