結果
問題 | No.1611 Minimum Multiple with Double Divisors |
ユーザー | wolgnik |
提出日時 | 2021-07-21 23:15:01 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,847 bytes |
コンパイル時間 | 311 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 77,496 KB |
最終ジャッジ日時 | 2024-07-17 20:21:29 |
合計ジャッジ時間 | 42,968 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | TLE | - |
testcase_01 | TLE | - |
testcase_02 | TLE | - |
testcase_03 | TLE | - |
testcase_04 | TLE | - |
testcase_05 | TLE | - |
testcase_06 | TLE | - |
testcase_07 | TLE | - |
testcase_08 | TLE | - |
testcase_09 | TLE | - |
testcase_10 | AC | 1,721 ms
77,252 KB |
testcase_11 | AC | 1,726 ms
76,668 KB |
testcase_12 | AC | 1,732 ms
76,616 KB |
testcase_13 | AC | 1,713 ms
76,920 KB |
testcase_14 | AC | 1,726 ms
77,436 KB |
testcase_15 | AC | 1,699 ms
77,056 KB |
testcase_16 | AC | 1,716 ms
76,700 KB |
testcase_17 | AC | 1,762 ms
76,660 KB |
testcase_18 | AC | 1,729 ms
76,972 KB |
testcase_19 | AC | 83 ms
73,344 KB |
testcase_20 | AC | 85 ms
73,472 KB |
testcase_21 | AC | 87 ms
75,300 KB |
testcase_22 | AC | 97 ms
76,672 KB |
testcase_23 | AC | 88 ms
77,052 KB |
testcase_24 | AC | 82 ms
73,472 KB |
testcase_25 | AC | 84 ms
74,112 KB |
testcase_26 | AC | 82 ms
74,240 KB |
testcase_27 | AC | 81 ms
73,344 KB |
testcase_28 | AC | 38 ms
58,240 KB |
testcase_29 | AC | 38 ms
58,624 KB |
testcase_30 | AC | 39 ms
59,648 KB |
testcase_31 | AC | 39 ms
59,136 KB |
testcase_32 | AC | 40 ms
59,392 KB |
testcase_33 | AC | 38 ms
59,392 KB |
testcase_34 | AC | 38 ms
59,392 KB |
testcase_35 | AC | 40 ms
59,776 KB |
testcase_36 | AC | 39 ms
59,392 KB |
testcase_37 | AC | 38 ms
59,392 KB |
testcase_38 | AC | 37 ms
58,880 KB |
ソースコード
import sys input = sys.stdin.readline class sieve: def __init__(self, n): self.n = n self.sv = [1] * (n + 1) self.sv[0] = 0 self.sv[1] = 0 self.minp = [n] * (n + 1) for i in range(2, n + 1): if self.sv[i]: self.minp[i] = i for j in range(i * 2, n + 1, i): self.sv[j] = 0 self.minp[j] = min(self.minp[j], i) def isprime(self, x): if x > self.n: return False return self.sv[x] == 1 def factorize(self, x): if self.sv[x]: return [(x, 1)] res = [] while x > 1: p = self.minp[x] c = 0 while x % p == 0: x //= p c += 1 res.append((p, c)) return res def modlcm(self, a, mod): res = [0] * (self.n + 1) ex = set() for i in range(len(a)): f = self.factorize(a[i]) for j in f: if j > self.n: ex.add(j) continue res[j] = max(f.count(j), res[j]) rres = 1 for i in range(self.n + 1): if res[i] != 0: rres *= pow(i, res[i], mod) rres %= mod for i in ex: rres *= i rres %= mod return rres sv = sieve(10 ** 2) primes = [] for x in range(100): if sv.isprime(x): primes.append(x) for _ in range(int(input())): x = int(input()) res = 10 ** 30 for p in primes: if x % p: res = min(res, x * p) else: t = x c = 0 while t % p == 0: t //= p c += 1 res = min(res, x * p ** (c + 1)) #print(res, p, c) #print(res) for d in range(2, 33): z = 1. for p in primes: if d % p or x % p: continue cx = 0 cd = 0 t = x while t % p == 0: t //= p cx += 1 t = d while t % p == 0: t //= p cd += 1 z *= (cx + cd + 1) / (cx + 1) if z == 2: res = min(res, x * d) print(res)