The previous thread has fallen off the front page, feel free to use this for discussions on current problems

Rules: no spoilers, use the handy dandy spoiler preset to mark discussions as spoilers

  • swlabr@awful.systems
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    15 days ago

    Day 13, day 13 of shirking other responsibilities.

    p1

    Ok. So, I overthought this a little. Ultimately, this problem boils down to solving a system of 2 linear equations aka inverting a matrix.

    Of course, anyone who has done undergraduate linear algebra knows to look to the determinant in case some shit goes down. For the general problem space, a zero determinant means that one equation is just a multiple of the other. A solution could still exist in this case. Consider:

    a => x+1, y+1
    b => x+2, y+2
    x = 4, y = 4 (answer: 2 tokens)
    

    The following has no solution:

    a => x+2, y+2
    b => x+4, y+4
    x = 3, y = 3
    

    I thought of all this, and instead of coding the solution, I just checked if any such cases were in my input. There weren’t, and I was home free.

    p2

    No real changes to the solution to p1 aside from the new targets. I wasn’t sure if 64 bit ints were big enough to fit the numbers so I changed my code to use big ints.

    I’m looking at my code again and I’m pretty sure that was all unnecessary.

    • zogwarg@awful.systems
      link
      fedilink
      English
      arrow-up
      3
      ·
      edit-2
      15 days ago

      I liked day 13, a bit easy but in the right way.

      Edit:

      Spoilers

      Although saying “minimum” was a bit evil when all of the systems had exactly 1 solution (not necessarily in ℕ^2), I wonder if it’s puzzle trickiness, anti-LLM (and unfortunate non comp-sci souls) trickiness or if the puzzle was maybe scaled down from a version where there are more solutions.

      • swlabr@awful.systems
        link
        fedilink
        English
        arrow-up
        2
        ·
        15 days ago
        spoiler

        Given the lack of edge cases, I feel the latter possibility is strong. I’m just glad it was easy!

    • Architeuthis@awful.systems
      link
      fedilink
      English
      arrow-up
      3
      ·
      edit-2
      15 days ago
      13 commentary

      Solved p1 by graph search before looking a bit closer on the examples and going, oh…

      In pt2 I had some floating point weirdness when solving for keypress count, I was checking if the key presses where integers (can’t press button A five and half times after all) by checking if A = floor(A) and sometimes A would drop to the number below when floored, i.e. it was in reality (A-1).999999999999999999999999999999999999999999999. Whatever, I rounded it away but I did spend a stupid amount of time on it because it didn’t happen in the example set.