結果

問題 No.594 壊れた宝物発見機
ユーザー vwxyzvwxyz
提出日時 2022-08-03 02:04:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,186 bytes
コンパイル時間 636 ms
コンパイル使用メモリ 10,980 KB
実行使用メモリ 24,676 KB
平均クエリ数 55.00
最終ジャッジ日時 2023-10-01 02:43:48
合計ジャッジ時間 6,018 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 123 ms
24,388 KB
testcase_14 WA -
testcase_15 AC 121 ms
23,928 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline

def Interactive(*query):
    print(*query)
    sys.stdout.flush()
    return input()

def Tersect_Int(L,R,f,eps=1e-12,maximize=False):
    f_L,f_R=f(L),f(R)
    while abs(R-L)>1:
        l,r=(2*L+R+1)//3,(L+2*R+1)//3
        f_l,f_r=f(l),f(r)
        if maximize:
            if f_l>=f_r>=f_R:
                R=r
                f_R=f_r
            elif f_L<=f_l<=f_r:
                L=l
                f_L=f_l
            else:
                L,R=l,r
                f_L,f_R=f_l,f_r
        else:
            if f_l<=f_r<=f_R:
                R=r
                f_R=f_r
            elif f_L>=f_l>=f_r:
                L=l
                f_L=f_l
            else:
                L,R=l,r
                f_L,f_R=f_l,f_r
    if maximize:
        if f_L<=f_R:
            retu=R
        else:
            retu=L
    else:
        if f_L<=f_R:
            retu=L
        else:
            retu=R
    return retu

def fx(x):
    return int(Interactive("?",x,0,0))
def fy(y):
    return int(Interactive("?",0,y,0))
def fz(z):
    return int(Interactive("?",0,0,z))
print("!",Tersect_Int(-15,15,fx),Tersect_Int(-15,15,fy),Tersect_Int(-15,15,fz))
0