結果

問題 No.1233 割り切れない気持ち
ユーザー H3PO4H3PO4
提出日時 2022-07-01 14:19:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 159 ms / 3,153 ms
コード長 564 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 82,660 KB
実行使用メモリ 128,512 KB
最終ジャッジ日時 2024-05-04 08:25:30
合計ジャッジ時間 5,167 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,504 KB
testcase_01 AC 38 ms
53,760 KB
testcase_02 AC 37 ms
53,760 KB
testcase_03 AC 41 ms
62,080 KB
testcase_04 AC 44 ms
61,696 KB
testcase_05 AC 35 ms
54,016 KB
testcase_06 AC 35 ms
53,760 KB
testcase_07 AC 82 ms
86,272 KB
testcase_08 AC 96 ms
93,184 KB
testcase_09 AC 130 ms
107,936 KB
testcase_10 AC 138 ms
110,024 KB
testcase_11 AC 79 ms
85,168 KB
testcase_12 AC 149 ms
112,768 KB
testcase_13 AC 152 ms
112,768 KB
testcase_14 AC 152 ms
112,940 KB
testcase_15 AC 159 ms
112,944 KB
testcase_16 AC 158 ms
112,836 KB
testcase_17 AC 61 ms
84,868 KB
testcase_18 AC 154 ms
128,512 KB
testcase_19 AC 69 ms
90,468 KB
testcase_20 AC 64 ms
84,736 KB
testcase_21 AC 64 ms
85,760 KB
testcase_22 AC 61 ms
85,888 KB
testcase_23 AC 63 ms
85,504 KB
testcase_24 AC 63 ms
85,532 KB
testcase_25 AC 66 ms
85,632 KB
testcase_26 AC 65 ms
85,760 KB
testcase_27 AC 75 ms
91,776 KB
testcase_28 AC 78 ms
91,664 KB
testcase_29 AC 75 ms
91,136 KB
testcase_30 AC 75 ms
90,972 KB
testcase_31 AC 73 ms
91,392 KB
testcase_32 AC 74 ms
90,964 KB
testcase_33 AC 75 ms
91,264 KB
testcase_34 AC 74 ms
91,188 KB
testcase_35 AC 79 ms
91,392 KB
testcase_36 AC 77 ms
91,148 KB
testcase_37 AC 38 ms
53,504 KB
testcase_38 AC 72 ms
89,984 KB
testcase_39 AC 120 ms
108,412 KB
testcase_40 AC 120 ms
108,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import Counter

input = sys.stdin.buffer.readline

N = int(input())
A = Counter(map(int, input().split()))
MAX = max(A)
A_freq = [0] * (MAX + 1)
for k, v in A.items():
    A_freq[k] += v
A_freq_acc = [0] * (MAX + 1)
for i in range(1, MAX + 1):
    A_freq_acc[i] = A_freq_acc[i - 1] + A_freq[i]


def div_sum(a):
    res = 0
    for i, x in enumerate(range(a - 1, MAX, a), 1):
        res += i * (A_freq_acc[min(x + a, MAX)] - A_freq_acc[x])
    return res


ans = 0
for k, v in A.items():
    ans += k * v * (N - div_sum(k))
print(ans)
0