結果
| 問題 | No.3717 GCD LCM GCD |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2026-09-18 23:03:19 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 818 bytes |
| 記録 | |
| コンパイル時間 | 79 ms |
| コンパイル使用メモリ | 81,152 KB |
| 実行使用メモリ | 329,600 KB |
| 最終ジャッジ日時 | 2026-09-18 23:03:36 |
| 合計ジャッジ時間 | 10,592 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 -- * 2 |
| other | WA * 5 TLE * 2 -- * 1 |
ソースコード
import sys
input = sys.stdin.readline
mod=998244353
# x以下の素数の列挙,素因数分解,約数の列挙
import math
x=10**6+1
L=math.floor(math.sqrt(x)) # 平方根を求める
Primelist=[i for i in range(x+1)]
Primelist[1]=0 # 1は素数でないので0にする.
for i in Primelist:
if i>L:
break
if i==0:
continue
for j in range(2*i,x+1,i):
Primelist[j]=0
Primes=[Primelist[j] for j in range(x+1) if Primelist[j]!=0]
from math import gcd,lcm
N,K=list(map(int,input().split()))
A=list(map(int,input().split()))
ANS=1
for p in Primes:
L=[]
for a in A:
x=a
count=0
while x%p==0:
count+=1
x//=p
L.append(count)
#print(p,L)
L.sort()
c=L[K-1]
ANS=ANS*pow(p,c)%mod
print(ANS)
titia