Primitive logic and coding of information

    So, quite a while ago I came across a rather interesting task:
    Vile invaders captured the village of megamind, lined them one after another in a column so that each previous one sees all the subsequent ones. A black or white cap is put on each megamind so that not one megamind sees its cap. Starting from the very last one (the one that sees everyone except itself), each megamind takes turns asking the color of its hat; if it is wrong, it is killed. But just for this case, the megamind agreed in advance how to minimize the number of deaths. What have the megamind agreed?
    (all refer to braingames.ru, but in fact this site is a vile plagiarist, an ancient task, they altered it to their own specifics, they added megamind brain everywhere, and gave it away as their own)
    At first it seemed that half of those killed were a joy for this village. But, having thought a little, I came across (one girl prompted me) a fairly simple solution: brains agree in advance and if the color in front of you is white, then your color is pronounced (sorry, the first megamind, you will die in 50% of cases ...) loudly, otherwise it’s quiet. But this is a primitive, although it already gives twice the best result - 99 megamindbands will remain alive.
    Now my final version: the last one that sees everyone considers pairing, for example, black. If it turned out a pair, he says that he is black. He, unfortunately, is the only one who risks dying. The next one considers black pairing; if paired, it is white (the number of blacks has not changed), otherwise it is black, the next is similar.

    What struck me in solving this problem was that a truly astounding result was achieved - at first it seemed that saving at least 50% was an excellent result, however, by sacrificing the life of only one of the megamindbags (in 50% of cases), everyone else could be saved!

    Also popular now: