My Python 3 submission got a "Wrong Answer" on Test Set 1 inexplicably. 
Since then, I have made the same submission over and over again, and it 
always passes. For Test Set 1, there should be no RNG in the solution - so 
I don't see how there can be a "Wrong Answer". Unfortunately, I can't seem 
to reproduce this - all my Practice Attempts since with identical code has 
successfully passed all Test sets:

<https://i.imgur.com/Ix52Zv5.png>



I'd love to know if anyone can reproduce this error that appears to be on 
the server-side. I am pasting my code below:

# Codejam 2020, Round 1B: Blindfolded Bullseye

import sys
from random import randint


class Case:
    def __init__(self):
        self.queries_left = 300

    def query(self, X, Y):
        self.queries_left -= 1
        print("{} {}".format(X, Y), flush=True)
        response = input()
        if response == 'WRONG':
            sys.exit()
        return response

    def binary_search_left(self, right, func):
        left = -10**9
        while left < right:
            m = (left + right) // 2
            f = func(m)
            if f == 'HIT':
                right = m
            elif f == 'MISS':
                left = m + 1
            else:
                return None
        return left

    def binary_search_right(self, left, func):
        right = 10**9
        while left < right:
            m = (left + right) // 2
            f = func(m)
            if f == 'HIT':
                left = m + 1
            elif f == 'MISS':
                right = m
            else:
                return None
        return right - 1

    def solve(self):
        x, y = 0, 0
        r = self.query(x, y)
        while r == 'MISS':
            x, y = randint(-10**9, 10**9), randint(-10**9, 10**9)
            r = self.query(x, y)

        if r == 'CENTER':
            return

        x_low = self.binary_search_left(x, lambda x: self.query(x, y))
        if x_low is None:
            return

        x_high = self.binary_search_right(x, lambda x: self.query(x, y))
        if x_high is None:
            return

        y_low = self.binary_search_left(y, lambda y: self.query(x, y))
        if y_low is None:
            return

        y_high = self.binary_search_right(y, lambda y: self.query(x, y))
        if y_high is None:
            return

        r = self.query((x_low + x_high) // 2, (y_low + y_high) // 2)
        if r != 'CENTER':
            sys.exit()


# I/O Code
num_cases, A, B = map(int, input().split())

for _ in range(1, num_cases + 1):
    case = Case()
    case.solve()

sys.exit()


Thanks

-- 
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 google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/3c160542-486b-4d3b-add5-7268e05f4d8e%40googlegroups.com.

Reply via email to