結果

問題 No.376 立方体のN等分 (2)
ユーザー mkawa2mkawa2
提出日時 2020-03-26 13:08:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,107 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 10,944 KB
実行使用メモリ 9,348 KB
最終ジャッジ日時 2023-08-30 12:22:04
合計ジャッジ時間 64,697 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
8,972 KB
testcase_01 AC 20 ms
8,896 KB
testcase_02 WA -
testcase_03 AC 1,200 ms
8,872 KB
testcase_04 AC 1,799 ms
8,912 KB
testcase_05 AC 21 ms
8,952 KB
testcase_06 AC 21 ms
8,912 KB
testcase_07 AC 21 ms
8,880 KB
testcase_08 AC 166 ms
8,864 KB
testcase_09 AC 343 ms
8,904 KB
testcase_10 AC 421 ms
9,072 KB
testcase_11 AC 1,540 ms
8,912 KB
testcase_12 AC 879 ms
8,868 KB
testcase_13 AC 1,126 ms
8,952 KB
testcase_14 AC 1,337 ms
9,040 KB
testcase_15 AC 1,853 ms
8,948 KB
testcase_16 AC 1,205 ms
9,316 KB
testcase_17 AC 1,303 ms
8,996 KB
testcase_18 AC 2,076 ms
9,080 KB
testcase_19 AC 1,361 ms
8,884 KB
testcase_20 AC 2,424 ms
8,972 KB
testcase_21 WA -
testcase_22 AC 2,166 ms
9,048 KB
testcase_23 AC 1,434 ms
9,192 KB
testcase_24 AC 1,437 ms
9,228 KB
testcase_25 AC 1,480 ms
8,884 KB
testcase_26 AC 1,447 ms
9,172 KB
testcase_27 AC 3,438 ms
8,920 KB
testcase_28 AC 2,298 ms
8,916 KB
testcase_29 AC 2,476 ms
9,024 KB
testcase_30 AC 1,642 ms
8,996 KB
testcase_31 AC 2,139 ms
8,972 KB
testcase_32 AC 1,713 ms
8,864 KB
testcase_33 AC 1,475 ms
8,980 KB
testcase_34 AC 1,888 ms
9,076 KB
testcase_35 AC 4,444 ms
8,976 KB
testcase_36 AC 2,283 ms
8,928 KB
testcase_37 AC 2,281 ms
8,916 KB
testcase_38 AC 4,372 ms
8,976 KB
testcase_39 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
from bisect import *
from collections import *
from heapq import *

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def SI(): return sys.stdin.readline()[:-1]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
int1 = lambda x: int(x) - 1
def MI1(): return map(int1, sys.stdin.readline().split())
def LI1(): return list(map(int1, sys.stdin.readline().split()))
p2D = lambda x: print(*x, sep="\n")
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]

def main():
    def fac(n):
        res=[]
        for d in range(1,n+1):
            if d**2>n:break
            if n%d==0:res.append(d)
        return res

    def cal(m):
        f=ff[m]
        n1=n//f
        for d in range(int(n1**0.5)+1,0,-1):
            if n1%d==0:return d+n1//d+f-3

    n=II()
    ff=fac(n)
    fn=len(ff)
    l=-1
    r=fn
    while l+2<r:
        m1=(l*2+r)//3
        m2=(l+r*2)//3
        if cal(m1)<cal(m2):r=m2
        else:l=m1
    print(cal((l+r)//2),n-1)

main()
0