結果
| 問題 |
No.1917 LCMST
|
| コンテスト | |
| ユーザー |
PNJ
|
| 提出日時 | 2024-08-29 19:34:17 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 458 bytes |
| コンパイル時間 | 590 ms |
| コンパイル使用メモリ | 82,512 KB |
| 実行使用メモリ | 225,964 KB |
| 最終ジャッジ日時 | 2024-08-29 19:34:37 |
| 合計ジャッジ時間 | 17,545 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 33 |
ソースコード
N = int(input())
A = list(map(int,input().split()))
M = 100000
B = [0] * (M + 1)
m = min(A)
if m == 1:
print(sum(A) - 1)
exit()
for a in A:
B[a] += 1
ans = 0
for a in range(2,M):
if B[a] == 0:
continue
ans += a * (B[a] - 1)
B[a] = 1
res = 0
for i in range(2,M + 1):
if a * i > M:
break
res += B[a * i] * a * i
B[a * i] = 0
ans += res
for a in range(m + 1,M + 1):
if B[a] == 0:
continue
ans += a * m
print(ans)
PNJ