結果

問題 No.1233 割り切れない気持ち
ユーザー ayaoniayaoni
提出日時 2020-11-22 09:37:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 163 ms / 3,153 ms
コード長 553 bytes
コンパイル時間 1,328 ms
コンパイル使用メモリ 86,572 KB
実行使用メモリ 116,532 KB
最終ジャッジ日時 2023-09-30 22:33:21
合計ジャッジ時間 7,423 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
90,988 KB
testcase_01 AC 89 ms
91,068 KB
testcase_02 AC 99 ms
91,024 KB
testcase_03 AC 105 ms
91,744 KB
testcase_04 AC 100 ms
91,240 KB
testcase_05 AC 94 ms
90,936 KB
testcase_06 AC 96 ms
90,920 KB
testcase_07 AC 124 ms
98,352 KB
testcase_08 AC 129 ms
103,784 KB
testcase_09 AC 147 ms
107,776 KB
testcase_10 AC 153 ms
108,612 KB
testcase_11 AC 115 ms
97,164 KB
testcase_12 AC 159 ms
108,608 KB
testcase_13 AC 163 ms
108,672 KB
testcase_14 AC 154 ms
108,672 KB
testcase_15 AC 158 ms
108,648 KB
testcase_16 AC 155 ms
108,984 KB
testcase_17 AC 124 ms
116,332 KB
testcase_18 AC 156 ms
108,644 KB
testcase_19 AC 132 ms
108,952 KB
testcase_20 AC 130 ms
116,236 KB
testcase_21 AC 130 ms
111,996 KB
testcase_22 AC 131 ms
111,748 KB
testcase_23 AC 124 ms
111,700 KB
testcase_24 AC 124 ms
111,748 KB
testcase_25 AC 124 ms
111,732 KB
testcase_26 AC 124 ms
111,700 KB
testcase_27 AC 129 ms
109,408 KB
testcase_28 AC 130 ms
109,416 KB
testcase_29 AC 130 ms
109,452 KB
testcase_30 AC 129 ms
109,356 KB
testcase_31 AC 129 ms
109,364 KB
testcase_32 AC 131 ms
109,412 KB
testcase_33 AC 129 ms
109,420 KB
testcase_34 AC 129 ms
109,652 KB
testcase_35 AC 129 ms
109,544 KB
testcase_36 AC 130 ms
109,432 KB
testcase_37 AC 91 ms
90,932 KB
testcase_38 AC 126 ms
116,532 KB
testcase_39 AC 147 ms
108,932 KB
testcase_40 AC 147 ms
108,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0