結果

問題 No.1312 Snake Eyes
ユーザー rlangevinrlangevin
提出日時 2023-04-17 19:22:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 821 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 77,312 KB
最終ジャッジ日時 2024-04-20 22:15:39
合計ジャッジ時間 34,230 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
64,896 KB
testcase_01 AC 54 ms
64,640 KB
testcase_02 AC 55 ms
64,896 KB
testcase_03 AC 40 ms
51,584 KB
testcase_04 AC 53 ms
64,512 KB
testcase_05 AC 54 ms
64,512 KB
testcase_06 AC 53 ms
64,512 KB
testcase_07 AC 57 ms
64,896 KB
testcase_08 AC 55 ms
64,768 KB
testcase_09 AC 54 ms
64,512 KB
testcase_10 AC 54 ms
64,896 KB
testcase_11 AC 54 ms
64,512 KB
testcase_12 AC 53 ms
64,640 KB
testcase_13 AC 54 ms
64,640 KB
testcase_14 AC 54 ms
64,512 KB
testcase_15 AC 52 ms
64,896 KB
testcase_16 AC 53 ms
64,640 KB
testcase_17 AC 53 ms
64,768 KB
testcase_18 AC 54 ms
64,768 KB
testcase_19 AC 54 ms
64,640 KB
testcase_20 AC 54 ms
64,896 KB
testcase_21 AC 54 ms
64,896 KB
testcase_22 AC 55 ms
64,640 KB
testcase_23 AC 81 ms
76,416 KB
testcase_24 AC 79 ms
73,856 KB
testcase_25 AC 80 ms
72,960 KB
testcase_26 AC 72 ms
72,448 KB
testcase_27 AC 77 ms
73,856 KB
testcase_28 AC 101 ms
73,728 KB
testcase_29 AC 101 ms
76,160 KB
testcase_30 AC 86 ms
76,160 KB
testcase_31 AC 84 ms
76,416 KB
testcase_32 AC 82 ms
76,032 KB
testcase_33 AC 75 ms
73,216 KB
testcase_34 AC 81 ms
76,160 KB
testcase_35 AC 82 ms
76,160 KB
testcase_36 AC 83 ms
76,160 KB
testcase_37 AC 83 ms
76,032 KB
testcase_38 AC 105 ms
76,288 KB
testcase_39 AC 131 ms
76,544 KB
testcase_40 AC 127 ms
76,800 KB
testcase_41 AC 121 ms
76,544 KB
testcase_42 AC 107 ms
76,288 KB
testcase_43 AC 122 ms
76,672 KB
testcase_44 AC 105 ms
76,672 KB
testcase_45 AC 117 ms
76,544 KB
testcase_46 AC 120 ms
76,544 KB
testcase_47 AC 114 ms
76,544 KB
testcase_48 AC 1,126 ms
76,672 KB
testcase_49 AC 956 ms
77,184 KB
testcase_50 AC 756 ms
76,800 KB
testcase_51 AC 426 ms
76,800 KB
testcase_52 WA -
testcase_53 AC 876 ms
76,928 KB
testcase_54 AC 1,033 ms
76,672 KB
testcase_55 WA -
testcase_56 AC 720 ms
77,056 KB
testcase_57 WA -
testcase_58 AC 924 ms
76,800 KB
testcase_59 AC 393 ms
76,544 KB
testcase_60 WA -
testcase_61 AC 1,185 ms
76,672 KB
testcase_62 AC 532 ms
76,672 KB
testcase_63 AC 102 ms
76,544 KB
testcase_64 AC 130 ms
76,800 KB
testcase_65 AC 213 ms
76,800 KB
testcase_66 AC 74 ms
72,320 KB
testcase_67 AC 55 ms
64,768 KB
testcase_68 AC 137 ms
76,544 KB
testcase_69 AC 85 ms
76,544 KB
testcase_70 AC 961 ms
76,672 KB
testcase_71 AC 596 ms
76,672 KB
testcase_72 AC 131 ms
76,672 KB
testcase_73 AC 101 ms
76,288 KB
testcase_74 AC 75 ms
72,960 KB
testcase_75 AC 105 ms
76,288 KB
testcase_76 AC 1,211 ms
77,056 KB
testcase_77 WA -
testcase_78 AC 1,226 ms
76,800 KB
testcase_79 AC 926 ms
77,312 KB
testcase_80 AC 1,207 ms
77,056 KB
testcase_81 AC 1,270 ms
76,672 KB
testcase_82 AC 1,226 ms
76,800 KB
testcase_83 AC 1,205 ms
76,288 KB
testcase_84 WA -
testcase_85 AC 1,064 ms
77,056 KB
testcase_86 AC 1,049 ms
77,184 KB
testcase_87 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
if N == 1:
    print(2)
    exit()

P = [[1] * 45 for i in range(1000)]
inf = 10 ** 18
for i in range(1000):
    for j in range(44):
        P[i][j + 1] = min(inf, P[i][j] * i)

def f(p, d):
    if p >= 10 ** 9:
        return inf
    if p >= 10 ** 6 and d >= 3:
        return inf
    if p >= 10 ** 4 and d >= 4:
        return inf
    return (p ** d - 1) // (p - 1)

ans = N + 1
for d in range(2, 45):
    for v in range(1, 10**18):
        if v * f(v + 1, d) > N:
            break
        yes = v + 1
        no = N + 1
        if no <= yes:
            break
        while no - yes != 1:
            mid = (yes + no)//2
            if v * f(mid, d) <= N:
                yes = mid
            else:
                no  = mid
        if v * f(yes, d) == N:
            ans = min(ans, yes)

print(ans)
0