結果
問題 | No.1611 Minimum Multiple with Double Divisors |
ユーザー | 👑 obakyan |
提出日時 | 2021-07-21 23:47:13 |
言語 | Lua (LuaJit 2.1.1696795921) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,836 bytes |
コンパイル時間 | 290 ms |
コンパイル使用メモリ | 5,376 KB |
実行使用メモリ | 6,912 KB |
最終ジャッジ日時 | 2024-10-03 02:42:38 |
合計ジャッジ時間 | 19,053 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 228 ms
6,820 KB |
testcase_01 | AC | 201 ms
6,784 KB |
testcase_02 | AC | 209 ms
6,784 KB |
testcase_03 | AC | 204 ms
6,820 KB |
testcase_04 | AC | 203 ms
6,784 KB |
testcase_05 | AC | 205 ms
6,784 KB |
testcase_06 | AC | 198 ms
6,784 KB |
testcase_07 | AC | 193 ms
6,784 KB |
testcase_08 | AC | 205 ms
6,784 KB |
testcase_09 | AC | 208 ms
6,820 KB |
testcase_10 | AC | 126 ms
6,912 KB |
testcase_11 | TLE | - |
testcase_12 | AC | 1,714 ms
6,820 KB |
testcase_13 | AC | 1,534 ms
6,784 KB |
testcase_14 | AC | 1,617 ms
6,784 KB |
testcase_15 | AC | 1,720 ms
6,784 KB |
testcase_16 | AC | 1,716 ms
6,784 KB |
testcase_17 | AC | 1,650 ms
6,784 KB |
testcase_18 | AC | 1,709 ms
6,912 KB |
testcase_19 | AC | 14 ms
6,784 KB |
testcase_20 | AC | 14 ms
6,784 KB |
testcase_21 | AC | 15 ms
6,784 KB |
testcase_22 | AC | 16 ms
6,784 KB |
testcase_23 | AC | 14 ms
6,784 KB |
testcase_24 | AC | 15 ms
6,784 KB |
testcase_25 | AC | 15 ms
6,784 KB |
testcase_26 | AC | 15 ms
6,784 KB |
testcase_27 | AC | 15 ms
6,784 KB |
testcase_28 | AC | 11 ms
6,784 KB |
testcase_29 | AC | 11 ms
6,784 KB |
testcase_30 | AC | 11 ms
6,784 KB |
testcase_31 | AC | 11 ms
6,784 KB |
testcase_32 | AC | 11 ms
6,784 KB |
testcase_33 | AC | 11 ms
6,784 KB |
testcase_34 | AC | 11 ms
6,816 KB |
testcase_35 | AC | 11 ms
6,656 KB |
testcase_36 | AC | 11 ms
6,784 KB |
testcase_37 | AC | 11 ms
6,816 KB |
testcase_38 | AC | 11 ms
6,784 KB |
ソースコード
local mce, mfl, msq, mmi, mma, mab = math.ceil, math.floor, math.sqrt, math.min, math.max, math.abs local function getprimes(x) local primes = {} local allnums = {} for i = 1, x do allnums[i] = true end for i = 2, x do if allnums[i] then table.insert(primes, i) local lim = mfl(x / i) for j = 2, lim do allnums[j * i] = false end end end return primes end local function getdivisorparts(x, primes) local prime_num = #primes local tmp = {} local lim = mce(msq(x)) local primepos = 1 local dv = primes[primepos] while primepos <= prime_num and dv <= lim do if x % dv == 0 then x = mfl(x / dv) local cnt = 1 while x % dv == 0 do x = mfl(x / dv) cnt = cnt + 1 end tmp[dv] = cnt lim = mce(msq(x)) end if primepos == prime_num then break end primepos = primepos + 1 dv = primes[primepos] end if x ~= 1 then tmp[x] = 1 end return tmp end local primes = getprimes(mce(msq(100000000000))) local predvp = {0} for i = 2, 31 do predvp[i] = getdivisorparts(i, primes) end local q = io.read("*n") for iq = 1, q do local x = io.read("*n") local v = false for i = 1, #primes do local p = primes[i] if x % p ~= 0 then v = p break end end local ans = 1 * v local dvp = getdivisorparts(x, primes) local tot = 1 for k, v in pairs(dvp) do tot = tot * (1 + v) end for j = 2, ans - 1 do local dvp2 = j <= 31 and predvp[j] or getdivisorparts(j, primes) local tot2 = tot for k, v in pairs(dvp2) do if dvp[k] then tot2 = mfl(tot2 * (dvp[k] + v + 1) / (dvp[k] + 1)) else tot2 = tot2 * (v + 1) end end if tot * 2 == tot2 then ans = j break end end print(ans * x) end -- print(os.clock())