結果

問題 No.456 Millions of Submits!
ユーザー maspymaspy
提出日時 2020-03-27 10:14:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,601 ms / 4,500 ms
コード長 547 bytes
コンパイル時間 410 ms
コンパイル使用メモリ 10,816 KB
実行使用メモリ 353,212 KB
最終ジャッジ日時 2023-08-30 16:15:06
合計ジャッジ時間 13,166 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
29,556 KB
testcase_01 AC 137 ms
29,668 KB
testcase_02 AC 135 ms
29,664 KB
testcase_03 AC 134 ms
29,680 KB
testcase_04 AC 133 ms
29,676 KB
testcase_05 AC 134 ms
29,628 KB
testcase_06 AC 133 ms
29,740 KB
testcase_07 AC 135 ms
29,948 KB
testcase_08 AC 136 ms
29,940 KB
testcase_09 AC 157 ms
32,696 KB
testcase_10 AC 160 ms
32,764 KB
testcase_11 AC 369 ms
62,244 KB
testcase_12 AC 2,601 ms
353,212 KB
権限があれば一括ダウンロードができます

ソースコード

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(15):
    newton(X)


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