Can somebody describe their solution to http://codeforces.net/gym/100519/problem/I ? Somehow I can't shake the feeling that it's enough to always multiply with 2, but I cannot substantiate my intuition to turn this into an algorithm.
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3831 |
3 | Radewoosh | 3646 |
4 | jqdai0815 | 3620 |
4 | Benq | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | gamegame | 3386 |
10 | ksun48 | 3373 |
# | User | Contrib. |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 160 |
5 | -is-this-fft- | 158 |
6 | awoo | 157 |
7 | adamant | 156 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | Dominater069 | 153 |
Can somebody describe their solution to http://codeforces.net/gym/100519/problem/I ? Somehow I can't shake the feeling that it's enough to always multiply with 2, but I cannot substantiate my intuition to turn this into an algorithm.
Name |
---|
spoiler
The first one is more along the lines of what I was thinking :) The second idea is magical.
It became one of my favourite problems few days ago :)! Indeed, we will use just multiplying by 2. Consider fraction . If we have a fraction f, we multiply it by 2 and then receive information ">" we know that and if we receive "<", we know that . Inductively if we receive informations "<<>><><" and we change each "<" to "1" and ">" to "0" (unless p! = 2 we can't receive "=") we got a prefix of binary representation of f (following "0."), so "<<>><><" changes to "0011010" and we know that . Using 40 questions we can get approximation of with error at most 2 - 40, but if and are potential starting fractions we know that , so this precision is sufficient to uniquely determine starting fraction :)!
Oh wow, that's a really nice solution! Thanks for sharing.
Amazing!
Oh my god
A wise man.^_^