Telepathy
시간 제한2초메모리 제한1024 MB
두 형제가 각자 자신의 무작위 이진 문자열만 보고 상대 문자열에서 k개 위치를 골라, 짝지은 자릿수의 3분의 2 이상이 일치하도록 만드는 전략을 세운다.
문제
Brothers Flim and Flam are performing a trick they call "telepathy".
At the beginning, Discord, who is the host, generates two random binary strings and . Each string contains digits, and each digit is equal to zero or one equiprobably and independently of other digits. String is given to Flim, and string to Flam. Each of them sees only his own string, and doesn't know the string of his brother.
After that, each brother selects distinct positions in the string: not in his own, but in his brother's string that they do not know!
Finally, Discord looks at string from left to right, and writes down the digits from the positions selected by Flam. Then he looks at string from left to right and, under the previous line, writes down the digits from the positions selected by Flim. After that, the audience counts how many times a digit from turned out to be the same as a digit from written under it. To "prove" that telepathy works, more than two thirds of the pairs of digits have to turn out the same, that is, at least of them.
Help Flim and Flam to plan how to select positions in each other's strings knowing only their own string, so that they can "prove" that telepathy works.
Consider a small example.
- To keep things short, let and .
- Let string be
00101011011110111001. - Let string be
11000111101000011010. - Flim sees string and selects positions in string .
- Flam sees string and selects positions in string .
- Discord writes down , , , , .
- And under them, , , , , .
- Out of five pairs, the digits are the same in each pair except the first ( but ).
- It means Flim and Flam achieved equalities.
- The portion of equalities is greater than , so the brothers "proved" that telepathy works!