結果

問題 No.456 Millions of Submits!
ユーザー maspy
提出日時 2020-03-27 10:13:58
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 3,991 ms / 4,500 ms
コード長 547 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 338,772 KB
最終ジャッジ日時 2025-01-02 08:22:04
合計ジャッジ時間 18,241 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

M = int(readline())
ABT = np.array(read().split(), np.float64)
A = ABT[::3]
B = ABT[1::3]
T = ABT[2::3]
LT = np.log(T)

X = np.ones_like(T) * 0.0001

def newton(X):
    f = A * X + B * np.log(X) - LT
    df = A + B / X
    X -= f / df
    return


for _ in range(30):
    newton(X)


answer = np.exp(X)
answer[B == 0] = np.exp(LT[B == 0] / A[B == 0])
print('\n'.join(answer.astype(str)))
0