結果
問題 |
No.2420 Simple Problem
|
ユーザー |
|
提出日時 | 2023-08-13 09:05:38 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 777 bytes |
コンパイル時間 | 221 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 70,820 KB |
最終ジャッジ日時 | 2024-11-21 02:36:59 |
合計ジャッジ時間 | 94,688 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 1 WA * 3 TLE * 29 |
ソースコード
import sys import logging import math input = sys.stdin.readline logger = logging.getLogger(__name__) def read(): N = int(input().strip()) AB = [] for i in range(N): a, b = map(int, input().strip().split()) AB.append((a, b)) return N, AB def judge(x, a, b): left = a * b * 4 right = (x * x - a - b) * (x * x - a - b) return left < right def solve(N, AB): for a, b in AB: ok = 10**11 ng = 2 while abs(ok - ng) > 1: x = (ok + ng) // 2 if judge(x, a, b): ok = x else: ng = x print(ok) if __name__ == "__main__": inputs = read() outputs = solve(*inputs) if outputs is not None: print("%s" % str(outputs))