This forum is in permanent archive mode. Our new active community can be found here.

Weekend coding

1232426282939

Comments

  • Running your own server is also a monumental headache for the untrained. Everything is great until that first time you get hacked. Then it is stress city afterwards.

    That extra money you pay for a managed server is worth it unless you have the skills. It is not unlike car maintenance. Changing the oil and basic preventive maintenance is easy but is rebuilding the engine and drive train something you want to do with your daily driver or would you rather pay someone to do it for you to minimize the time your car is out of service?
  • HMTKSteve said:

    Running your own server is also a monumental headache for the untrained. Everything is great until that first time you get hacked. Then it is stress city afterwards.

    That extra money you pay for a managed server is worth it unless you have the skills. It is not unlike car maintenance. Changing the oil and basic preventive maintenance is easy but is rebuilding the engine and drive train something you want to do with your daily driver or would you rather pay someone to do it for you to minimize the time your car is out of service?

    I'm here to learn.

  • By all means learn, just don't learn on a production server.
  • I attended the first week of the programming competition, it was kind of weird as it was in groups of 3, we had one guy who was doing the programming and wanted to turn everything including numbers into strings. And the other guy was just doing his first unit in computer science and kept on trying to solve logic problems with pure maths but refused to write any pseudocode.

    They also weren't keen on writing new classes in Java to deal with the problems.

    Using Java for these problems made these problems feel super awkward.

    It's weird not being able to Google for assistance, I guess it's meant to be a check of how much knowledge you have on the fly?

    I will try to be the programmer next week. I don't expect to win but at least be in the top 3 in the room and top 10 in Australia / New Zealand should be attainable if I get matched up with 2 people who have a more mature CS understanding.
  • sK0pe said:

    I attended the first week of the programming competition

    On that note, the qualification round for Google Code Jam happened not too long ago; are you participating sK0pe?
  • Andrew said:

    image

    Dat Monaco styling.
  • edited April 2015

    sK0pe said:

    I attended the first week of the programming competition

    On that note, the qualification round for Google Code Jam happened not too long ago; are you participating sK0pe?
    Oh damn I was meant to, I got stuck on a silly Data mining project and an Algorithms exam.

    I cancelled my reminder to register rather than snoozing it I thought it was another ICPC reminder :disappointed:.

    I guess I'll do the questions anyway, I don't think I would have made it further than round 1 or 2 based on last year's questions and other people who did last year's questions.

    If you're doing it to can I see your approach to the questions after each round?
    sK0pe said:


    I will try to be the programmer next week. I don't expect to win but at least be in the top 3 in the room and top 10 in Australia / New Zealand should be attainable if I get matched up with 2 people who have a more mature CS understanding.

    I forgot about this post, my team finished 2nd in the Monash competition and could have been equal first if I had 2 minutes more to fix a bug in one of my loops.
    Post edited by sK0pe on
  • Apreche said:

    Dat Monaco styling.

    Yeah, Monaco was actually a pretty big influence on my FOV implementation. It's still not perfect yet (it's a bit slow in Debug mode), however I'm happy with the results. The next step is to figure out how to get it integrated with lighting so that it applies the proper effect.

  • edited April 2015
    sK0pe said:

    sK0pe said:

    I attended the first week of the programming competition

    On that note, the qualification round for Google Code Jam happened not too long ago; are you participating sK0pe?
    Oh damn I was meant to, I got stuck on a silly Data mining project and an Algorithms exam.

    I cancelled my reminder to register rather than snoozing it I thought it was another ICPC reminder :disappointed:.

    I guess I'll do the questions anyway, I don't think I would have made it further than round 1 or 2 based on last year's questions and other people who did last year's questions.
    Yeah, making it to Round 3 is really hard, and I haven't gotten there before, but the top 1000 in Round 2 get a T-shirt. I've gotten two T-shirts before, so realistically speaking my goal is to get another one, and hopefully make it to Round 3 as well.
    sK0pe said:

    If you're doing it to can I see your approach to the questions after each round?

    Well, I can't stop you ;)
    I qualified at #643 due to making a minor error for the large dataset of Q4 (I fixed it within a few minutes when I found out I got it wrong); you can see my submissions here:
    https://code.google.com/codejam/contest/6224486/scoreboard?c=6224486#vf=1&sp=631
    Post edited by lackofcheese on
  • Free pitcher of beer.
  • It just so happens that our last project for my CS class involves parsing text and formatting it with HTML.....you know, everything one of my methods for the forum app did. Well this is going to be even easier than normal.
  • Well, I can't stop you ;)
    I qualified at #643 due to making a minor error for the large dataset of Q4 (I fixed it within a few minutes when I found out I got it wrong); you can see my submissions here:
    https://code.google.com/codejam/contest/6224486/scoreboard?c=6224486#vf=1&sp=631

    I looked at the problems today, A, B and D were all quite straight forward.
    I would have had to look up Djikstra's to apply it for problem C.

    I think you missed only one case for large input D.

    Man I'm regretting not signing up as soon as registration opened.

    I think these problems are like Google asking "can you even program bro?"
  • Yeah, the qualification round tends to be like that.
  • Augh, I got nerd-sniped. I looked at the qualification round questions and filled up a notebook page with notes trying to optimize the second one.
  • edited April 2015

    Augh, I got nerd-sniped. I looked at the qualification round questions and filled up a notebook page with notes trying to optimize the second one.

    Surely you passed though, even a few first years were getting over 70 points.

    What is super strange is the people who are full on into the programming competitions look down on Java as a stupid language to code in yet the person who scored first in code jam did so through Java. I understand Java can be obscenely verbose when you want to write something simple but language doesn't determine how well you can problem solve.

    I forget if I was that silly when I was their age.
    Post edited by sK0pe on
  • I could have passed were I competing, but I didn't hear about it until just now. Also I'm ineligible anyways due to working for The Google.
  • Participate under a pseudonym. Then when you win pull off your mask and declare that it was you the whole time.
  • If only I didn't want to not get fired...
  • I could have passed were I competing, but I didn't hear about it until just now. Also I'm ineligible anyways due to working for The Google.

    Yeah I forgot, my friend who graduated last year who is working at Google Mountain View is on zero points on our leader-board because we forgot to remove his name from Code Jam.

    I'm so surprised only 50% of entrants passed the qualification round, I've fully written them in a few hours.

    I was also surprised that many people didn't realise that problem D was just writing out a hard coded result over anything tricky, question A was just an aggregating count of values in an array. Problem C you could solve by modding out the first 24 blocks and looking for i and k then ending it with a 1.

    Problem B I stumbled upon till I worked out you could try to divide the pancakes so they are 2 on each plate.

    How did more experienced people approach B, was there a quick or obvious way to find the optimal solution?
  • edited April 2015
    My process for B wasn't quick or obvious: The fact that you can do all the swaps up front without losing time was pretty obvious, and so you could express the time requirement as the number of swaps to make all the stacks less then a size k, plus k.
    But then I went down the path of considering a recursive algorithm by optimizing k starting at half the size of the largest pile (so you'd only have to make one swap per pile in an iteration of the algorithm). I figured out the math for that, but thought I could probably do a single pass. A bunch of math later I realized that the number of swaps to reduce a pile of size P to sizes less than k is just ceil(P/k), at which point I hit myself on the forehead because I'd wasted a bunch of time.
    After that I just spent a bunch of time trying to figure out bounds on k, but didn't hit on the best way. According to the official analysis, you can set up a sparse matrix representing how the number of swaps for each diner changes as k increases, and then sum the rows to get a pretty direct answer for how the total time changes for various values of k.
    I thing I was reasonably close to stumbling on the last optimization at one point, but never came up with it.
    So the best possible time for the algorithm was O(sqrt(P)*D), where P is the size of the largest pile, while I had an O(P*D) solution at my best.

    Anyways, I think the obvious insights are realizing that you should do all the swaps up front and focusing on optimizing the maximum post-swap stack size. The smart thing to do from there is to directly find the number of swaps to get from a single stack of one size to set of stacks with a specific maximum size, but I went off into the weeds a bit there. I don't think the last optimization would be obvious unless you've seen the problem before - basically only if you're a machine learning or computer vision professional.
    Post edited by Linkigi(Link-ee-jee) on
  • After reading the problem my initial idea was similar to the story of trying to split stacks in half until they reach a max. Then I started thinking about just calcuating out the amount of splits to reach various M, then adding M to that and then trying to choose the min.

    But then I just read the answer. Didn't think about doing smaller splits, although I should have. I never would have come up with the "optimization" most likely..
  • edited April 2015
    Well, I didn't get through Round 1A, which was a bit disappointing (1156th). Mostly I was just a bit too slow; I spent too much time thinking about a properly efficient solution for B when I had already very quickly come up with one that was good enough.

    I knew how to solve problem C, but I couldn't put a solution together in time. I tried a brute-forcey solution using an already-made convex hull library, but I ran into problems with degenerate cases and I didn't have enough time to fix it.
    Post edited by lackofcheese on
  • Oh, and I now have a valid solution to the small input anyway; it's something I already had the idea for during the round, but I skipped over actually using it because I was looking for faster approaches.

    Whoops...
  • I've since solved the large input as well, though the method I used took 5 minutes; perhaps somewhat borderline w.r.t. the time limit, but then it would probably be 5x faster in C instead of Python.
  • I've since solved the large input as well, though the method I used took 5 minutes; perhaps somewhat borderline w.r.t. the time limit, but then it would probably be 5x faster in C instead of Python.

    I don't think I could have written a solution to Problem C in the time given unless my first attempt was bug free.
    Problems A and B were quite harmless although embarrassingly I took a long time working out that the Y output was an aggregate of the min(maxDifference, array element).

    I was surprised by how many people compete with Python, I can only guess that it's because you need to type the least amount for any given function.

    I wonder if people are using Lambda functions to shorten their Java code (since Java 1.8 was released). Java seems to be grabbing some of the properties of Python. The default sort is now the same as Python since 1.7 (Timsort) as well.

    It's super painful to use when you need to bang out a quick application but I know more Java than anything else, will practice C and C++ but most of my units this semester expect Java solutions.
  • image

    This is probably what it would be like if I shared my code with anyone.
  • Wanted to mess around in Unity, so I mocked up an idea for a PC style advanced wars game last night.
    image
  • I had been thinking about doing an advance wars clone. I haven't started anything, so I guess I'm a shit-thinker.
Sign In or Register to comment.