Doron, You're handling the "wrong answer" case wrong. You code keeps running, which might end up being a runtime error or a time-limit. Try 'return' instead of 'break'.
Your binary search won't solve this problem. Try putting a number of small cases in and see what happens. If that isn't easy to do, try working out some *really* small cases by hand. Also, try some large cases. I don't know whether int(input()) will work, though I suspect it will. Good luck! Bartholomew On Sun, Apr 1, 2018 at 11:44 AM Doron Veltzer <[email protected]> wrote: > On Sunday, April 1, 2018 at 5:29:08 PM UTC+3, Paul Smith wrote: > > Are you running the right version of Python? > > > > > > On Sun, 1 Apr 2018 at 09:11, Xiongqi ZHANG <[email protected]> wrote: > > Would you share your python solution? Maybe we can take a look. > > > > > > > > -- > > > > You received this message because you are subscribed to the Google > Groups "Google Code Jam" group. > > > > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected]. > > > > To post to this group, send email to [email protected]. > > > > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-code/3b224b01-3ff8-4beb-8b33-a3d14d25d628%40googlegroups.com > . > > > > For more options, visit https://groups.google.com/d/optout. > > ran 3.6.3 before but I changed it to 3.5.3. (though I'm quite certain I > used nothing that should be affected by the version change) > > This is the output of running `python testing_tool.py python A.py` > python testing_tool.py python A.py > Your code finishes with exit status 0. > Your code doesn't have stderr output. > Congratulations! All test cases passed :) > > Not sure which version of the code to send, but something along these lines > > import sys > > > t = int(input()) > for _ in range(t): > a, b = [int(s) for s in input().split(" ")] > n = int(input()) > for _ in range(n): > p = int((a + b) / 2) > print(p) > sys.stdout.flush() > s = input() > if s == "TOO_BIG": > b = p > elif s == "TOO_SMALL": > a = p > elif s == "WRONG_ANSWER": > break > elif s == "CORRECT": > break > else: > break > > -- > You received this message because you are subscribed to the Google Groups > "Google Code Jam" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-code/8d03a265-7b62-40b3-a070-43129e9e3834%40googlegroups.com > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/CAHaiWHMtEi7jeLBzzH9%3DXGO5Wvg%2BGjvikex7tDGC1iMZfniGaw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
