結果
| 問題 |
No.2420 Simple Problem
|
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2023-08-12 16:57:53 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 757 ms / 2,000 ms |
| コード長 | 460 bytes |
| コンパイル時間 | 253 ms |
| コンパイル使用メモリ | 82,108 KB |
| 実行使用メモリ | 76,544 KB |
| 最終ジャッジ日時 | 2024-11-20 06:49:08 |
| 合計ジャッジ時間 | 24,567 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 33 |
ソースコード
def issatisfy(m, a, b) -> bool:
s = m**2 - (a + b)
if s <= 0: return False
x = 4 * a * b
y = s ** 2
return x < y
# INF = 1 << 60
INF = 10 ** 5
N = int(input())
for _ in range(N):
A, B = map(int, input().split())
lo = 1
hi = INF
ans = INF
while lo <= hi:
m = (lo + hi) // 2
if issatisfy(m, A, B):
ans = min(ans, m)
hi = m - 1
else:
lo = m + 1
print(ans)
norioc