| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 986142 | amirala21 | Guess the number (BOI20_guess) | Cpython 3 | 10 ms | 2996 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
import math
import sys
def binary_search_guessing_game():
upperBoundary = int(input("input"))
sys.stdout.flush()
lowerBoundary = 1
finalGuess = None
for _ in range(50):
guess = math.floor((upperBoundary + lowerBoundary) / 2)
print(f"? {guess}")
sys.stdout.flush()
response = int(input())
if response == 0:
finalGuess = guess
break
elif response == 1:
upperBoundary = guess - 1
elif response == -1:
lowerBoundary = guess + 1
if finalGuess is not None:
print(f"= {finalGuess}")
sys.stdout.flush()
binary_search_guessing_game()| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
