Hacker News new | ask | show | jobs
by klyrs 668 days ago
To elaborate on a point of 0xfaded's comment, the "12 of 13 possible pairs" is the crux of the solution. And when I solved this as a budding math student, I found two solutions -- I first, laboriously, worked top-down and came up with an entire decision tree. It was manifestly beautiful but entirely inelegant. So I worked from the bottom up, and found this solution.

How do we work from the bottom up? We construct a "truth table" for the various results, note the symmetry,

    --- +++ A
    --0 ++0 B
    --+ ++- C
    -0- +0+ D
    -00 +00 E
    -0+ +0- F
    -+- +-+ G
    -+0 +-0 H
    -++ +-- I
    0-- 0++ J
    0-0 0+0 K
    0-+ 0+- L
    00- 00+ M
    000 000 X
When I read off this "truth table" I immediately see a parity issue: it's telling me to weigh (ABCDEFGHI) all at the same time. Nine balls? That's not gonna balance out. Also, all of those balls have the same apparent sign for the first weighing so I'll need to break parity somehow. What if I just alternate signs as I walk down the table?

    --- +++ A
    ++0 --0 B
    --+ ++- C
    +0+ -0- D
    -00 +00 E
    +0- -0+ F
    -+- +-+ G
    +-0 -+0 H
    -++ +-- I
    0++ 0-- J
    0-0 0+0 K
    0+- 0-+ L
    00- 00+ M
    000 000 X
    
Alright, this gives the weighings

  ACEGI BDFH
  ACHK  BGIJL
  AFGLM CDIJ
Now, we take a popularity contest: who only shows up in overloaded pans? Discard the G and we arrive at

  ACEI BDFH
  ACHK BIJL
  AFLM CDIJ