結果

問題 No.3072 Sum of sqrt(x)
ユーザー maspymaspy
提出日時 2020-06-21 11:22:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 627 bytes
コンパイル時間 593 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 194,048 KB
最終ジャッジ日時 2024-04-18 16:00:14
合計ジャッジ時間 45,688 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 500 ms
44,600 KB
testcase_01 AC 504 ms
44,220 KB
testcase_02 AC 500 ms
43,844 KB
testcase_03 AC 499 ms
44,216 KB
testcase_04 AC 493 ms
44,216 KB
testcase_05 AC 495 ms
44,600 KB
testcase_06 AC 499 ms
44,224 KB
testcase_07 TLE -
testcase_08 AC 1,067 ms
175,476 KB
testcase_09 AC 1,175 ms
190,200 KB
testcase_10 AC 1,521 ms
175,408 KB
testcase_11 AC 1,769 ms
177,148 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

nums = np.array(read().split(), np.float64)[1:]
np.sqrt(nums, out=nums)
integer = nums.astype(np.int64)
frac = nums - integer
np.cumsum(integer, out=integer)

k = np.searchsorted(integer, 2 ** 20)
frac_1, frac_2 = np.divmod(frac[:k], 0.5 ** 20)
np.cumsum(frac_1, out=frac_1)
np.cumsum(frac_2, out=frac_2)
frac[:k] = frac_1 * (0.5 ** 20) + frac_2
if 0<k<len(nums)-1:
    frac[k] += frac[k - 1]
np.cumsum(frac[k:], out=frac[k:])
frac += integer
x = frac
print('\n'.join(map(str, x.tolist())))
0