結果

問題 No.1233 割り切れない気持ち
ユーザー H3PO4H3PO4
提出日時 2022-07-01 08:29:45
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 436 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 116,992 KB
最終ジャッジ日時 2024-05-04 03:47:33
合計ジャッジ時間 8,793 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
68,736 KB
testcase_01 AC 51 ms
62,720 KB
testcase_02 AC 55 ms
63,616 KB
testcase_03 AC 68 ms
65,664 KB
testcase_04 AC 61 ms
64,640 KB
testcase_05 AC 58 ms
63,360 KB
testcase_06 AC 57 ms
63,360 KB
testcase_07 AC 88 ms
82,048 KB
testcase_08 AC 105 ms
92,800 KB
testcase_09 AC 133 ms
106,100 KB
testcase_10 AC 136 ms
109,696 KB
testcase_11 AC 80 ms
80,128 KB
testcase_12 AC 141 ms
112,000 KB
testcase_13 AC 145 ms
112,216 KB
testcase_14 AC 139 ms
111,880 KB
testcase_15 AC 141 ms
111,936 KB
testcase_16 AC 144 ms
112,256 KB
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = tuple(map(int, input().split()))
MAX = 2 * 10 ** 5
A_freq = [0] * (MAX + 1)
for a in A:
    A_freq[a] += 1
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]

ans = N * sum(A)
for a in A:
    div_sum = 0
    for i, x in enumerate(range(a - 1, MAX, a), 1):
        div_sum += i * (A_freq_acc[min(x + a, MAX)] - A_freq_acc[x])
    ans -= a * div_sum
print(ans)
0