結果
問題 | No.1611 Minimum Multiple with Double Divisors |
ユーザー | mkawa2 |
提出日時 | 2023-03-10 09:00:17 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,678 bytes |
コンパイル時間 | 225 ms |
コンパイル使用メモリ | 82,444 KB |
実行使用メモリ | 82,652 KB |
最終ジャッジ日時 | 2024-09-18 03:13:49 |
合計ジャッジ時間 | 18,358 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge6 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,116 ms
81,480 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 501 ms
80,320 KB |
testcase_11 | AC | 449 ms
78,504 KB |
testcase_12 | AC | 445 ms
78,540 KB |
testcase_13 | AC | 436 ms
79,160 KB |
testcase_14 | AC | 445 ms
78,468 KB |
testcase_15 | AC | 446 ms
78,968 KB |
testcase_16 | AC | 449 ms
78,612 KB |
testcase_17 | AC | 434 ms
79,016 KB |
testcase_18 | AC | 438 ms
78,676 KB |
testcase_19 | AC | 85 ms
76,500 KB |
testcase_20 | AC | 90 ms
76,584 KB |
testcase_21 | AC | 86 ms
76,364 KB |
testcase_22 | AC | 86 ms
76,356 KB |
testcase_23 | AC | 94 ms
76,836 KB |
testcase_24 | AC | 89 ms
76,752 KB |
testcase_25 | AC | 87 ms
76,600 KB |
testcase_26 | AC | 94 ms
76,784 KB |
testcase_27 | AC | 84 ms
76,932 KB |
testcase_28 | AC | 39 ms
54,156 KB |
testcase_29 | AC | 38 ms
52,648 KB |
testcase_30 | AC | 40 ms
59,108 KB |
testcase_31 | AC | 41 ms
59,520 KB |
testcase_32 | AC | 41 ms
58,212 KB |
testcase_33 | AC | 43 ms
58,232 KB |
testcase_34 | AC | 42 ms
58,652 KB |
testcase_35 | AC | 41 ms
59,624 KB |
testcase_36 | AC | 41 ms
59,172 KB |
testcase_37 | AC | 41 ms
58,240 KB |
testcase_38 | AC | 42 ms
58,268 KB |
ソースコード
import sys # sys.setrecursionlimit(200005) int1 = lambda x: int(x)-1 pDB = lambda *x: print(*x, end="\n", file=sys.stderr) p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr) def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] # dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] inf = (1 << 63)-1 # inf = (1 << 31)-1 # md = 10**9+7 md = 998244353 prime = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] def gcd(a, b): while b: a, b = b, a%b return a def solve(): x0 = x = II() mn = inf to = [[] for _ in range(21)] for p in prime: e = 1 while x%p == 0: x //= p e += 1 # pDB(p, e) if e == 1: mn = p break c = p v = e+1 while c < 31 and e < 21 and v < 21: g = gcd(e, v) i = 1 while v//g*i < 21: to[e//g*i].append((v//g*i, c)) i += 1 c *= p v += 1 for s in range(2, 11): dist = [inf]*21 dist[s] = 1 for u in range(min(s*2, 21)): if dist[u] == inf: continue for v, c in to[u]: nd = dist[u]*c dist[v] = min(dist[v], nd) mn = min(mn, dist[s*2]) print(x0*mn) for _ in range(II()): solve()