結果
問題 |
No.2046 Ans Mod? Mod Ans!
|
ユーザー |
![]() |
提出日時 | 2022-08-19 22:04:03 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 168 ms / 4,000 ms |
コード長 | 429 bytes |
コンパイル時間 | 218 ms |
コンパイル使用メモリ | 82,308 KB |
実行使用メモリ | 111,232 KB |
最終ジャッジ日時 | 2024-12-16 08:17:25 |
合計ジャッジ時間 | 2,880 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
n=int(input()) a=list(map(int,input().split())) a.sort() cnt=[0]*(2*10**5+100) wa=[0]*(n+3) for i in range(n-1,-1,-1): cnt[a[i]]+=1 wa[i]=wa[i+1]+a[i] for i in range(2*10**5,-1,-1): cnt[i]+=cnt[i+1] ans=0 for i in range(n): res=0 res+=a[i]*(n-1-i) res-=wa[i+1] for p in range(a[i],2*10**5+1,a[i]): if p==a[i]:res+=a[i]*(cnt[p]-1) else:res+=a[i]*cnt[p] ans+=res print(ans)