結果

問題 No.1233 割り切れない気持ち
ユーザー ntudantuda
提出日時 2021-10-08 22:52:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 162 ms / 3,153 ms
コード長 479 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 87,276 KB
実行使用メモリ 112,404 KB
最終ジャッジ日時 2023-09-30 12:01:51
合計ジャッジ時間 7,456 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
80,916 KB
testcase_01 AC 85 ms
80,792 KB
testcase_02 AC 90 ms
81,040 KB
testcase_03 AC 98 ms
81,308 KB
testcase_04 AC 96 ms
81,068 KB
testcase_05 AC 89 ms
80,768 KB
testcase_06 AC 90 ms
81,076 KB
testcase_07 AC 118 ms
87,880 KB
testcase_08 AC 130 ms
93,660 KB
testcase_09 AC 150 ms
105,216 KB
testcase_10 AC 156 ms
108,580 KB
testcase_11 AC 119 ms
87,168 KB
testcase_12 AC 162 ms
111,876 KB
testcase_13 AC 159 ms
112,164 KB
testcase_14 AC 160 ms
112,316 KB
testcase_15 AC 157 ms
112,084 KB
testcase_16 AC 158 ms
111,756 KB
testcase_17 AC 113 ms
109,544 KB
testcase_18 AC 161 ms
111,920 KB
testcase_19 AC 121 ms
112,404 KB
testcase_20 AC 111 ms
109,344 KB
testcase_21 AC 122 ms
110,620 KB
testcase_22 AC 122 ms
110,844 KB
testcase_23 AC 121 ms
110,856 KB
testcase_24 AC 120 ms
110,848 KB
testcase_25 AC 122 ms
110,668 KB
testcase_26 AC 121 ms
110,840 KB
testcase_27 AC 126 ms
111,612 KB
testcase_28 AC 124 ms
111,504 KB
testcase_29 AC 125 ms
111,376 KB
testcase_30 AC 124 ms
111,416 KB
testcase_31 AC 124 ms
111,216 KB
testcase_32 AC 124 ms
111,268 KB
testcase_33 AC 126 ms
111,320 KB
testcase_34 AC 121 ms
111,376 KB
testcase_35 AC 123 ms
111,264 KB
testcase_36 AC 126 ms
111,412 KB
testcase_37 AC 85 ms
80,792 KB
testcase_38 AC 110 ms
109,224 KB
testcase_39 AC 145 ms
110,884 KB
testcase_40 AC 147 ms
110,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
M = 200000
D = [0] * (M + 1)
DS = [0] * (M + 1)
S = [0] * (M + 1)
for a in A:
    D[a] += 1

for i in range(1, M+1):
    S[i] = S[i - 1] + i * D[i]
    DS[i] = DS[i - 1] + D[i]

ans = 0
for i in range(2, M+1):
    if D[i] > 0:
        ans += S[i - 1] * D[i]
        for j in range(1, M // i + 1):
            ans += D[i] * (S[min(i * (j + 1) - 1, M)] - S[i * j] - i * j * (DS[min(i * (j + 1) - 1, M)] - DS[i * j]))

print(ans)
0