結果

問題 No.1830 Balanced Majority
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2022-02-04 21:38:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 605 bytes
コンパイル時間 626 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 87,816 KB
平均クエリ数 11.15
最終ジャッジ日時 2023-09-02 04:37:36
合計ジャッジ時間 4,787 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
87,536 KB
testcase_01 AC 90 ms
87,316 KB
testcase_02 AC 92 ms
87,364 KB
testcase_03 AC 93 ms
87,204 KB
testcase_04 AC 91 ms
87,548 KB
testcase_05 AC 91 ms
87,544 KB
testcase_06 WA -
testcase_07 AC 96 ms
87,488 KB
testcase_08 AC 97 ms
86,764 KB
testcase_09 WA -
testcase_10 AC 96 ms
87,004 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 96 ms
87,756 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 95 ms
87,032 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 96 ms
87,108 KB
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

0 110

0 011

"""

import sys
from sys import stdin

def ask(i):

    print ("?",i,flush=True)
    cat = int(stdin.readline())
    return cat

N = int(stdin.readline())

one = ask(1)
two = ask(2)

a1 = one
a2 = two-one
if a1 != a2:
    print ("!",1,2,flush=True)
    sys.exit()

l = 2
r = N

while r-l != 1:

    m = (l+r)//2
    get = ask(m)

    x = get-a1 #one
    y = (m-1)-x #zero

    #print (m,x,y)

    if a2 == 1:
        if x <= y:
            r = m
        else:
            l = m
    else:
        if x >= y:
            r = m
        else:
            l = m

print ("!",2,r,flush=True)
0