結果

問題 No.2420 Simple Problem
ユーザー moharan627moharan627
提出日時 2023-08-12 14:41:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,339 bytes
コンパイル時間 662 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 96,260 KB
最終ジャッジ日時 2023-08-12 14:42:49
合計ジャッジ時間 58,128 ms
ジャッジサーバーID
(参考情報)
judge9 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,620 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 WA -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 1,663 ms
91,512 KB
testcase_28 AC 1,650 ms
92,380 KB
testcase_29 AC 1,633 ms
92,072 KB
testcase_30 AC 1,662 ms
92,548 KB
testcase_31 AC 1,639 ms
92,052 KB
testcase_32 AC 90 ms
71,524 KB
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10**9 + 7
MOD2 = 998244353
from collections import defaultdict
def ceil(A,B):
    return -(-A//B)
def solve():
    def II(): return int(sys.stdin.readline())
    def LI(): return list(map(int, sys.stdin.readline().split()))
    def LC(): return list(sys.stdin.readline().rstrip())
    def IC(): return [int(c) for c in sys.stdin.readline().rstrip()]
    def MI(): return map(int, sys.stdin.readline().split())
    N = II()



    def meguru_bisect(ng, ok):
        """
        (目的値)~正の無限 が条件を満たす場合
        ng…条件を満たさない値の範囲での最大値
        ok…条件を満たす値の範囲での最小値
        ng < ok
        is_ok == Trueの場合、探索範囲が左半分へ
        is_ok == Falseの場合、探索範囲が右半分へ
        """
        while (abs(ok - ng) > 1):
            mid = (ok + ng) // 2
            if is_ok(mid):
                ok = mid
            else:
                ng = mid
        return ok
    for i in range(N):
        A,B = MI()

        def is_ok(X):
            # 条件を満たすかどうか?問題ごとに定義
            return 2*A*B < X ** 4 + A ** 2 + B ** 2 - 2  * A *(X ** 2)- 2 * B * (X ** 2)
        print(meguru_bisect(0,10**6))
    return
solve()
0