結果

問題 No.2252 Find Zero
ユーザー ShirotsumeShirotsume
提出日時 2023-03-24 21:29:01
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 557 bytes
コンパイル時間 929 ms
コンパイル使用メモリ 81,532 KB
実行使用メモリ 87,316 KB
平均クエリ数 109.00
最終ジャッジ日時 2023-10-18 20:46:03
合計ジャッジ時間 4,109 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 97 ms
71,912 KB
testcase_03 AC 133 ms
80,556 KB
testcase_04 AC 101 ms
71,920 KB
testcase_05 AC 97 ms
71,920 KB
testcase_06 AC 97 ms
71,920 KB
testcase_07 AC 98 ms
71,920 KB
testcase_08 AC 123 ms
77,444 KB
testcase_09 RE -
testcase_10 AC 98 ms
71,920 KB
testcase_11 AC 97 ms
71,920 KB
testcase_12 AC 96 ms
71,920 KB
testcase_13 AC 95 ms
71,920 KB
testcase_14 AC 95 ms
71,920 KB
testcase_15 RE -
testcase_16 AC 95 ms
71,920 KB
testcase_17 AC 96 ms
71,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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()
s = set(range(n))
for i in range(n):
    if i not in s:
        continue
    if len(s) == 1:
        answer(s.pop())
    s.discard(i)
    z = query(i, i)
    if z == i:
        answer(z)
    s.discard(z)
0