結果

問題 No.2753 鳩の巣原理
ユーザー mkawa2mkawa2
提出日時 2024-05-10 22:19:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 280 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 27,592 KB
平均クエリ数 11.00
最終ジャッジ日時 2024-05-10 22:19:16
合計ジャッジ時間 3,613 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
27,224 KB
testcase_01 AC 51 ms
27,456 KB
testcase_02 AC 51 ms
27,224 KB
testcase_03 AC 51 ms
27,224 KB
testcase_04 AC 51 ms
27,352 KB
testcase_05 AC 48 ms
27,224 KB
testcase_06 AC 49 ms
27,352 KB
testcase_07 AC 48 ms
27,344 KB
testcase_08 AC 51 ms
27,224 KB
testcase_09 AC 48 ms
27,208 KB
testcase_10 AC 61 ms
27,592 KB
testcase_11 AC 48 ms
27,104 KB
testcase_12 AC 54 ms
27,336 KB
testcase_13 AC 50 ms
27,592 KB
testcase_14 AC 53 ms
27,208 KB
testcase_15 AC 50 ms
27,080 KB
testcase_16 AC 50 ms
27,208 KB
testcase_17 AC 50 ms
27,464 KB
testcase_18 AC 50 ms
27,208 KB
testcase_19 AC 50 ms
26,952 KB
testcase_20 AC 51 ms
27,080 KB
testcase_21 AC 49 ms
27,464 KB
testcase_22 AC 52 ms
26,816 KB
testcase_23 AC 57 ms
27,336 KB
testcase_24 AC 48 ms
27,464 KB
testcase_25 AC 50 ms
27,208 KB
testcase_26 AC 49 ms
26,824 KB
testcase_27 AC 50 ms
27,112 KB
testcase_28 AC 53 ms
26,952 KB
testcase_29 AC 50 ms
27,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def ask(i):
    print("?",i+1,flush=True)
    return int(input())-1

n=int(input())
a=[0]*n
a[n-1]=n-1
l,r=0,n-1
for _ in range(10):
    if l+1==r:
        ask(0)
    else:
        i=(l+r)//2
        a[i]=ask(i)
        if a[i]-a[l]<i-l:r=i
        else:l=i

print("Yes",l+1,r+1)
0