結果
| 問題 |
No.1233 割り切れない気持ち
|
| コンテスト | |
| ユーザー |
ayaoni
|
| 提出日時 | 2020-11-22 09:24:38 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 555 bytes |
| コンパイル時間 | 309 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 120,320 KB |
| 最終ジャッジ日時 | 2024-07-23 16:19:28 |
| 合計ジャッジ時間 | 6,636 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 28 WA * 11 |
ソースコード
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
j = 1
for j in range(2*i-1,2*10**5+1,i):
a += j//i*(s_count[j]-s_count[j-i])
a += 2*10**5//i*(s_count[-1]-s_count[i*(2*10**5//i)-1])
ans -= a*count[i]*i
print(ans)
ayaoni