結果

問題 No.1917 LCMST
ユーザー googol_S0googol_S0
提出日時 2022-04-29 23:43:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 694 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 273,016 KB
最終ジャッジ日時 2023-09-11 15:24:17
合計ジャッジ時間 31,825 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 189 ms
91,512 KB
testcase_01 AC 183 ms
91,292 KB
testcase_02 AC 187 ms
91,572 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 186 ms
91,468 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 396 ms
249,196 KB
testcase_35 AC 404 ms
248,600 KB
testcase_36 AC 402 ms
248,876 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
N=int(input())
A=list(map(int,input().split()))
A.sort()
S=set()
B=[]
ANS=0
for i in range(N):
  if A[i] in S:
    ANS+=A[i]
  else:
    B.append(A[i])
    S.add(A[i])
INF=10**12
N=len(B)
V=[INF]*123456
W=[INF]*N
D=[[] for i in range(100001)]
for i in range(1,100001):
  for j in range(i,100001,i):
    D[j].append(i)
for i in range(N):
  for j in range(len(D[B[i]])):
    W[i]=min(W[i],V[D[B[i]][j]])
    V[D[B[i]][j]]=min(V[D[B[i]][j]],A[i]//D[B[i]][j])
V=[INF]*123456
for i in range(N-1,-1,-1):
  for j in range(len(D[B[i]])):
    W[i]=min(W[i],V[D[B[i]][j]])
    V[D[B[i]][j]]=min(V[D[B[i]][j]],A[i]//D[B[i]][j])
X=[W[i]*B[i] for i in range(N)]
print(sum(X)-min(X)+ANS)
0