結果
問題 | No.1233 割り切れない気持ち |
ユーザー | ayaoni |
提出日時 | 2020-11-22 09:37:23 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 132 ms / 3,153 ms |
コード長 | 553 bytes |
コンパイル時間 | 157 ms |
コンパイル使用メモリ | 82,412 KB |
実行使用メモリ | 120,300 KB |
最終ジャッジ日時 | 2024-07-23 16:19:44 |
合計ジャッジ時間 | 5,765 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 39 |
ソースコード
import sys from itertools import accumulate def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) N = I() A = LI() count = [0]*(2*10**5+1) for a in A: count[a] += 1 s_count = list(accumulate(count)) ans = N*sum(A) for i in range(1,2*10**5+1): if count[i] == 0: continue a = 0 for j in range(1,(2*10**5)//i): a += j*(s_count[(j+1)*i-1]-s_count[j*i-1]) a += (2*10**5)//i*(s_count[-1]-s_count[((2*10**5)//i)*i-1]) ans -= a*count[i]*i print(ans)