結果

問題 No.368 LCM of K-products
ユーザー fumofumofunifumofumofuni
提出日時 2021-09-13 18:21:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 730 ms / 2,000 ms
コード長 550 bytes
コンパイル時間 529 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 78,224 KB
最終ジャッジ日時 2023-09-08 01:54:25
合計ジャッジ時間 14,388 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 562 ms
78,112 KB
testcase_01 AC 720 ms
77,964 KB
testcase_02 AC 710 ms
77,092 KB
testcase_03 AC 722 ms
77,892 KB
testcase_04 AC 730 ms
78,064 KB
testcase_05 AC 719 ms
77,168 KB
testcase_06 AC 93 ms
76,592 KB
testcase_07 AC 94 ms
76,596 KB
testcase_08 AC 97 ms
76,844 KB
testcase_09 AC 92 ms
76,296 KB
testcase_10 AC 94 ms
76,564 KB
testcase_11 AC 96 ms
76,468 KB
testcase_12 AC 99 ms
76,568 KB
testcase_13 AC 425 ms
77,988 KB
testcase_14 AC 601 ms
78,020 KB
testcase_15 AC 654 ms
78,060 KB
testcase_16 AC 589 ms
78,140 KB
testcase_17 AC 504 ms
77,920 KB
testcase_18 AC 682 ms
77,764 KB
testcase_19 AC 243 ms
77,548 KB
testcase_20 AC 484 ms
78,224 KB
testcase_21 AC 184 ms
77,180 KB
testcase_22 AC 640 ms
77,996 KB
testcase_23 AC 94 ms
76,620 KB
testcase_24 AC 97 ms
76,592 KB
testcase_25 AC 101 ms
76,720 KB
testcase_26 AC 95 ms
76,504 KB
testcase_27 AC 99 ms
76,704 KB
testcase_28 AC 95 ms
76,716 KB
testcase_29 AC 101 ms
76,564 KB
testcase_30 AC 103 ms
76,520 KB
testcase_31 AC 100 ms
76,344 KB
testcase_32 AC 98 ms
76,720 KB
testcase_33 AC 314 ms
77,704 KB
testcase_34 AC 720 ms
77,716 KB
権限があれば一括ダウンロードができます

ソースコード

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