結果

問題 No.2252 Find Zero
ユーザー 👑 KazunKazun
提出日時 2023-03-24 21:25:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 179 ms / 2,000 ms
コード長 412 bytes
コンパイル時間 762 ms
コンパイル使用メモリ 81,564 KB
実行使用メモリ 80,404 KB
平均クエリ数 78.17
最終ジャッジ日時 2023-10-18 20:40:45
合計ジャッジ時間 3,163 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
69,896 KB
testcase_01 AC 179 ms
80,404 KB
testcase_02 AC 87 ms
69,912 KB
testcase_03 AC 111 ms
75,380 KB
testcase_04 AC 91 ms
69,920 KB
testcase_05 AC 88 ms
69,920 KB
testcase_06 AC 88 ms
69,920 KB
testcase_07 AC 87 ms
69,920 KB
testcase_08 AC 101 ms
69,912 KB
testcase_09 AC 113 ms
77,428 KB
testcase_10 AC 88 ms
69,920 KB
testcase_11 AC 87 ms
69,920 KB
testcase_12 AC 88 ms
69,920 KB
testcase_13 AC 88 ms
69,920 KB
testcase_14 AC 88 ms
69,920 KB
testcase_15 AC 89 ms
69,920 KB
testcase_16 AC 88 ms
69,920 KB
testcase_17 AC 89 ms
69,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def question(x,y):
    print("?",x,y,flush=True)
    z=int(input())
    return z

def answer(k):
    print("!",k,flush=True)
    exit()

def solve():
    N=int(input())
    for t in range(N//2):
        x,y=2*t,2*t+1
        z=question(x,y)
        if z==x:
            answer(y)
        elif z==y:
            answer(x)
    else:
        answer(N-1)

#==================================================
solve()
0