結果

問題 No.2753 鳩の巣原理
ユーザー rlangevinrlangevin
提出日時 2024-05-10 22:48:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 408 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 82,496 KB
実行使用メモリ 70,548 KB
平均クエリ数 11.00
最終ジャッジ日時 2024-05-10 22:48:08
合計ジャッジ時間 3,463 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
68,864 KB
testcase_01 AC 51 ms
69,976 KB
testcase_02 AC 52 ms
69,088 KB
testcase_03 AC 52 ms
69,920 KB
testcase_04 AC 53 ms
69,608 KB
testcase_05 AC 57 ms
69,052 KB
testcase_06 AC 53 ms
68,960 KB
testcase_07 AC 54 ms
69,844 KB
testcase_08 AC 56 ms
68,676 KB
testcase_09 AC 55 ms
68,756 KB
testcase_10 AC 52 ms
70,036 KB
testcase_11 AC 53 ms
68,984 KB
testcase_12 AC 62 ms
70,348 KB
testcase_13 AC 53 ms
69,560 KB
testcase_14 AC 53 ms
70,248 KB
testcase_15 AC 61 ms
70,100 KB
testcase_16 AC 53 ms
69,004 KB
testcase_17 AC 53 ms
69,628 KB
testcase_18 AC 54 ms
69,728 KB
testcase_19 AC 53 ms
68,948 KB
testcase_20 AC 52 ms
69,288 KB
testcase_21 AC 53 ms
69,984 KB
testcase_22 AC 52 ms
69,644 KB
testcase_23 AC 52 ms
70,548 KB
testcase_24 AC 53 ms
69,980 KB
testcase_25 AC 54 ms
70,368 KB
testcase_26 AC 54 ms
69,668 KB
testcase_27 AC 52 ms
69,272 KB
testcase_28 AC 53 ms
68,956 KB
testcase_29 AC 54 ms
69,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def query(n):
    print("?", n, flush=True)
    return int(input())


N = int(input())
ans = [-1] * (N + 1)
ans[-1] = N - 1
l, r = 0, N
for i in range(10):
    mid = (l + r) // 2
    ans[mid] = query(mid)
    if ans[r] - ans[mid] >= r - mid:
        r = mid
    else:
        l = mid

for i in range(N):
    if ans[i] == ans[i + 1] and ans[i] != -1:
        print("Yes", i, i+1)
        exit()

assert False
0