結果

問題 No.368 LCM of K-products
ユーザー fumofumofunifumofumofuni
提出日時 2021-09-13 18:20:45
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
TLE  
実行時間 -
コード長 552 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 17,660 KB
最終ジャッジ日時 2023-09-08 01:53:17
合計ジャッジ時間 19,711 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 TLE -
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
mp=defaultdict(list)
def factorize(x):
    for i in range(2,40000):
        ret=0
        while x%i==0:
            ret+=1
            x//=i
        if ret:
            mp[i].append(ret)
    if x>1:
        mp[x].append(1)
N,K=map(int,input().split())
A=list(map(int,input().split()))
for i in range(N):
    factorize(A[i])
mod=1000000007
ans=1
for k,v in mp.items():
    list.sort(v)
    list.reverse(v)
    ret=0
    for i in range(min(len(v),K)):
        ret+=v[i]
    ans=ans*pow(int(k),ret,mod)%mod
print(ans)

0