Browse · MathNet
PrintBaltic Way 2019
Baltic Way 2019 counting and probability
Problem
A hacker is locked into an underground industrial complex. She is presented with a computer screen, on which appears a long message of length , consisting of the symbols , , , , exactly letters of each kind in some seemingly random order. The message may be manipulated by inserting any one of the combinations , , , , at an arbitrary place in the message. Such a combination may also be erased, wherever it may occur in the message. The hacker may escape when the system is cracked, which happens when only the word `EXIT` is printed on the screen. Show that she may escape using less than operations.
Solution
Let , so that the initial message has length , with exactly symbols of each kind. We first establish an invariant. Assign , , , , and let denote the sum of the values of all symbols appearing in the message. Initially, , and the sum stays invariant under all the legal transformations.
Our next observation is that we may always insert or delete the combination TETET, for and this works also in reverse. Required are six operations.
To crack the system, first insert XE behind every I, and XE in front of every T: , \quad . This requires at most operations, after which the message has length at most . It may now be considered a sequence of the four possible strings , , , .
Second, expand any single (not preceded by an ) into , and any single (not succeeded by a ) into : (one operation), (six operations). This requires at most operations, and the message now has length at most . It is at present reduced to some binary combination of the two strings , .
Third, effectuate all possible reductions There can be at most such reductions, totalling operations. The hacker will be left with a message of the types or or an empty screen. But since the invariant , the screen must now, in fact, be empty.
Fourth, insert EXIT, using more operations. The number of operations was at most
Our next observation is that we may always insert or delete the combination TETET, for and this works also in reverse. Required are six operations.
To crack the system, first insert XE behind every I, and XE in front of every T: , \quad . This requires at most operations, after which the message has length at most . It may now be considered a sequence of the four possible strings , , , .
Second, expand any single (not preceded by an ) into , and any single (not succeeded by a ) into : (one operation), (six operations). This requires at most operations, and the message now has length at most . It is at present reduced to some binary combination of the two strings , .
Third, effectuate all possible reductions There can be at most such reductions, totalling operations. The hacker will be left with a message of the types or or an empty screen. But since the invariant , the screen must now, in fact, be empty.
Fourth, insert EXIT, using more operations. The number of operations was at most
Techniques
Invariants / monovariantsAlgorithms