結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
29,720 KB
testcase_01 AC 142 ms
29,696 KB
testcase_02 AC 135 ms
29,676 KB
testcase_03 AC 136 ms
29,760 KB
testcase_04 AC 135 ms
29,760 KB
testcase_05 AC 137 ms
29,824 KB
testcase_06 AC 137 ms
29,732 KB
testcase_07 AC 140 ms
29,944 KB
testcase_08 AC 138 ms
29,992 KB
testcase_09 AC 165 ms
32,832 KB
testcase_10 AC 167 ms
32,832 KB
testcase_11 AC 431 ms
62,304 KB
testcase_12 AC 3,345 ms
353,172 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(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