|
|
I'll just combine two previous hints. Use bubble sort and THEN use random. Use bubble sort and THEN assert that the balls are the same color in (n / 2) and (n / 2 + 1) Никак не пойму,что обозначает "Во всех тестах, кроме первого, расстановки зашифрованы. Вы не должны пытаться расшифровывать эти данные (и не обязаны их считывать), однако наличие во вводе этой информации позволяет нам гарантировать, что в этой задаче заранее определённые тесты, которые не подстраиваются под вашу стратегию." Как выглядят эти данные и влияют ли они на решение? И вопрос тем,кто решил-всегда ли мы можем "угадать в среднем",что у нас в очередной игре ровно один 0(или 1)? P.S. Пока дошёл только до 70 теста P.S. Уже решил.Не заметил одну особенность. Edited by author 25.10.2015 00:00 The solution is independent to this data. It's hard to provide test data to checker programm and not to provide it to participant. Can you tell what feature you found? I still have WA 70 too and need any idea to improve my program. I have one question. If there are three balls: 1st - black, 2nd - white and 3rd - unknown color, is it possible to find numbers of 2 balls of the same color or no? Obviously it's not possible if you talk of a 100% chance. Then how can we guess it with 80% chance? I thought that we always can determine these positions with 100%. Correct me if I am wrong. «I thought that we always can determine these positions with 100%. Correct me if I am wrong.» Yes, you are wrong. Hint: try to think of a certain specific test that will aim to fail your algo. More particularly, even your test above will do — black, white, unknown. We have options of <1 2> (obviously wrong), <1 3> (wrong if 3 is white) and <2 3> (wrong if 3 is black). So we can't guess with a 100% chance. Anyways, here's that very minor hint i can give: use random(). Edited by author 28.03.2016 17:12 Thanks, I just wanted to know in what direction to think further... Edited by author 28.03.2016 17:44 Edited by author 28.03.2016 17:44 |
|
|