| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 986139 | amirala21 | Guess the number (BOI20_guess) | Cpython 3 | 11 ms | 2904 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
# -*- coding: utf-8 -*-
"""
Created on Sun May 19 23:49:29 2024
@author: amirk
"""
def binary_search(l,n):
mid=int((n+l)/2)
if(l<=n):
print(f'? {mid}')
q=int(input())
if q==-1:
binary_search(mid+1,N )
elif q==1:
binary_search(l, mid-1)
elif q==0:
return "= "+str(mid)
else:
return "Error"
return 'E'
N=int(input())
L=1
print(binary_search(L, N))| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
