結果

問題 No.376 立方体のN等分 (2)
ユーザー maspy
提出日時 2020-03-07 04:30:51
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 2,225 ms / 5,000 ms
コード長 541 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 210,212 KB
最終ジャッジ日時 2024-10-14 11:11:01
合計ジャッジ時間 38,093 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

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

import numpy as np

N = int(read())

x = np.arange(1, 10**7, dtype=np.int64)

div = x[N % x == 0]

def solve_fixed_x(x):
    M = N // x
    y = div[M % div == 0]
    z = M // y
    T = (x + y + z - 3)
    return T.min(), T.max()
    
INF = 10 ** 18
answer = [INF, -INF]

for x in div.tolist():
    a, b = solve_fixed_x(x)
    if answer[0] > a:
        answer[0] = a
    if answer[1] < b:
        answer[1] = b
print(*answer)
0