結果
| 問題 | 
                            No.2252 Find Zero
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-03-24 21:49:55 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 144 ms / 2,000 ms | 
| コード長 | 497 bytes | 
| コンパイル時間 | 191 ms | 
| コンパイル使用メモリ | 82,048 KB | 
| 実行使用メモリ | 81,248 KB | 
| 平均クエリ数 | 78.17 | 
| 最終ジャッジ日時 | 2024-09-18 17:00:18 | 
| 合計ジャッジ時間 | 3,462 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 18 | 
ソースコード
import sys
from collections import deque, Counter
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353
def query(x, y):
    print('?', x, y, flush=True)
    return ii()
def answer(z):
    print('!', z, flush=True)
    exit()
n = ii()
for i in range(0, n - 1, 2):
    z = query(i, i + 1)
    if z == i:
        answer(i + 1)
    elif z == i + 1:
        answer(i)
answer(n - 1)