Submission #6363153
Source Code Expand
test_mode = False #True
if test_mode:
import random
N = random.randint(1,10**9)
print(N)
def ask(n):
print('?', n)
if not test_mode:
ans = input().rstrip()
else:
ans = 'Y' if (n <= N and str(n) <= str(N)) or (n > N and str(n) > str(N)) else 'N'
return ans == 'Y'
def solve():
if ask(10**10):
# power of 10
for n in range(10,0,-1):
if not ask(10 ** n - 1):
return 10 ** n
return 1
# 以下10のべき乗以外
d = 10
while not ask(10 ** d):
# 10 のべきを投げると、辞書順では自動で勝つ
# よって、NO = n\leq 10^d
d -= 1
d += 1
# Nはd桁
left = 10 ** (d-1) # Nより小さい
right = 10 ** d - 1 # N以上
while right > left + 1:
mid = (left + right) // 2
if ask(mid * 10 ** 9):
# 数字順では勝つ
# 辞書順でmid >= NのときにTrue
right = mid
else:
left = mid
return right
answer = solve()
print('!', answer)
Submission Info
| Submission Time | |
|---|---|
| Task | E - Awkward Response |
| User | maspy |
| Language | Python (3.4.3) |
| Score | 800 |
| Code Size | 1116 Byte |
| Status | AC |
| Exec Time | 21 ms |
| Memory | 3404 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 800 / 800 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_example_01.txt |
| All | 00_example_01.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, 37.txt, 38.txt, 39.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_example_01.txt | AC | 20 ms | 3404 KiB |
| 01.txt | AC | 20 ms | 3400 KiB |
| 02.txt | AC | 20 ms | 3400 KiB |
| 03.txt | AC | 20 ms | 3396 KiB |
| 04.txt | AC | 20 ms | 3396 KiB |
| 05.txt | AC | 21 ms | 3400 KiB |
| 06.txt | AC | 21 ms | 3396 KiB |
| 07.txt | AC | 21 ms | 3400 KiB |
| 08.txt | AC | 21 ms | 3400 KiB |
| 09.txt | AC | 20 ms | 3400 KiB |
| 10.txt | AC | 20 ms | 3400 KiB |
| 11.txt | AC | 20 ms | 3400 KiB |
| 12.txt | AC | 21 ms | 3400 KiB |
| 13.txt | AC | 21 ms | 3400 KiB |
| 14.txt | AC | 21 ms | 3404 KiB |
| 15.txt | AC | 21 ms | 3400 KiB |
| 16.txt | AC | 21 ms | 3400 KiB |
| 17.txt | AC | 21 ms | 3396 KiB |
| 18.txt | AC | 20 ms | 3400 KiB |
| 19.txt | AC | 20 ms | 3400 KiB |
| 20.txt | AC | 20 ms | 3400 KiB |
| 21.txt | AC | 20 ms | 3396 KiB |
| 22.txt | AC | 20 ms | 3396 KiB |
| 23.txt | AC | 20 ms | 3400 KiB |
| 24.txt | AC | 20 ms | 3400 KiB |
| 25.txt | AC | 20 ms | 3396 KiB |
| 26.txt | AC | 20 ms | 3396 KiB |
| 27.txt | AC | 19 ms | 3400 KiB |
| 28.txt | AC | 19 ms | 3400 KiB |
| 29.txt | AC | 19 ms | 3400 KiB |
| 30.txt | AC | 19 ms | 3404 KiB |
| 31.txt | AC | 20 ms | 3400 KiB |
| 32.txt | AC | 20 ms | 3400 KiB |
| 33.txt | AC | 20 ms | 3400 KiB |
| 34.txt | AC | 20 ms | 3404 KiB |
| 35.txt | AC | 21 ms | 3404 KiB |
| 36.txt | AC | 21 ms | 3404 KiB |
| 37.txt | AC | 21 ms | 3400 KiB |
| 38.txt | AC | 21 ms | 3400 KiB |
| 39.txt | AC | 21 ms | 3400 KiB |