結果
問題 | No.1793 実数当てゲーム |
ユーザー | とりゐ |
提出日時 | 2021-11-19 15:36:45 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,145 bytes |
コンパイル時間 | 266 ms |
コンパイル使用メモリ | 86,940 KB |
実行使用メモリ | 94,300 KB |
平均クエリ数 | 2230.56 |
最終ジャッジ日時 | 2023-10-13 19:57:32 |
合計ジャッジ時間 | 5,861 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 98 ms
86,944 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 258 ms
94,288 KB |
testcase_06 | AC | 257 ms
94,056 KB |
testcase_07 | AC | 248 ms
93,204 KB |
testcase_08 | AC | 251 ms
93,204 KB |
testcase_09 | AC | 246 ms
93,804 KB |
testcase_10 | AC | 251 ms
93,548 KB |
testcase_11 | AC | 257 ms
94,208 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
ソースコード
from sys import stdout import math ''' 2^24=16777216=1.67*10^7 なので普通に二分探索をすると不十分 y が小さいなら絶対誤差が 10^-5 以下,大きいなら相対誤差が 10^-5 以下になるようにしてやるといい 最初に 167.77216 で二分探索を行ってみる これより大きければ対数を取って二分探索をしてみる ---> 相加平均,相乗平均だとだめで,調和平均が良さそう ''' def solve(): print('?',167.77216) stdout.flush() s=input() if s=='Yes': l,r=167.77216,1222*10**72 for i in range(23): mid=2/(1/l+1/r) print('?','{:.06f}'.format(mid)) stdout.flush() s=input() if s=='Yes': l=mid else: r=mid mid=2/(1/l+1/r) print('!','{:.06f}'.format((l+r)/2)) stdout.flush() elif s=='No': l,r=0,167.77216 for i in range(23): mid=(l+r)/2 print('?','{:.06f}'.format(mid)) stdout.flush() s=input() if s=='Yes': l=mid else: r=mid print('!','{:.06f}'.format((l+r)/2)) stdout.flush() t=int(input()) while t: solve() t-=1