結果

問題 No.1233 割り切れない気持ち
ユーザー Navier_Boltzmann
提出日時 2022-10-08 15:29:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 527 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 82,596 KB
実行使用メモリ 116,820 KB
最終ジャッジ日時 2024-06-22 18:36:53
合計ジャッジ時間 7,036 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 3 WA * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

# import pypyjit
# pypyjit.set_param('max_unroll_recursion=-1')
from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline

N = int(input())
A = list(map(int,input().split()))

S = sum(A)
M = max(A)
Y = [0]*(M+1)
for a in A:
    Y[a] += 1

B = list(accumulate([0]+Y))

T = [0]*(M+1)
for i in range(1,M+1):
    
    n = 1
    while n*i<M:
        T[i] += n*(B[min((n+1)*i,M)] - B[n*i])
        n += 1

ans = 0
for a in A:
    ans += a*T[a]
print(ans)
0