結果

問題 No.2753 鳩の巣原理
ユーザー shobonvip
提出日時 2024-05-10 22:09:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 342 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 82,352 KB
実行使用メモリ 70,564 KB
平均クエリ数 11.00
最終ジャッジ日時 2024-12-20 05:50:16
合計ジャッジ時間 4,243 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

# a[i] = i
n = int(input())

ub = n+1 #n # NG
lb = 0 #0 # OK
arub = n
arlb = 0
tim = 0
while ub - lb > 1:
	t = (ub + lb) // 2
	print(f"? {t}")
	tim += 1
	x = int(input())

	if arub - x < ub - t:
		lb = t
		arlb = x
	else:
		ub = t
		arub = x

assert tim <= 10
while tim < 10:
	print(f"? {1}")
	x = int(input())
	tim += 1

print("Yes",lb,lb+1)
0