結果
| 問題 |
No.180 美しいWhitespace (2)
|
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 16:31:24 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 67 ms / 5,000 ms |
| コード長 | 629 bytes |
| コンパイル時間 | 516 ms |
| コンパイル使用メモリ | 81,888 KB |
| 実行使用メモリ | 75,224 KB |
| 最終ジャッジ日時 | 2025-04-16 16:33:11 |
| 合計ジャッジ時間 | 3,306 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 31 |
ソースコード
n = int(input())
lines = []
for _ in range(n):
a, b = map(int, input().split())
lines.append((a, b))
def compute_f(x):
if x <= 0:
return float('inf')
max_val = -float('inf')
min_val = float('inf')
for a, b in lines:
val = a + b * x
if val > max_val:
max_val = val
if val < min_val:
min_val = val
return max_val - min_val
low = 1
high = 10**18
while low < high:
mid = (low + high) // 2
current = compute_f(mid)
next_val = compute_f(mid + 1)
if current <= next_val:
high = mid
else:
low = mid + 1
print(low)
lam6er