結果

問題 No.1233 割り切れない気持ち
ユーザー chineristACchineristAC
提出日時 2020-09-18 21:42:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 169 ms / 3,153 ms
コード長 570 bytes
コンパイル時間 405 ms
コンパイル使用メモリ 86,536 KB
実行使用メモリ 111,104 KB
最終ジャッジ日時 2023-09-04 21:43:58
合計ジャッジ時間 8,540 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
81,452 KB
testcase_01 AC 127 ms
81,540 KB
testcase_02 AC 128 ms
81,080 KB
testcase_03 AC 125 ms
81,200 KB
testcase_04 AC 126 ms
81,248 KB
testcase_05 AC 122 ms
81,524 KB
testcase_06 AC 124 ms
80,976 KB
testcase_07 AC 135 ms
87,876 KB
testcase_08 AC 139 ms
93,260 KB
testcase_09 AC 157 ms
105,052 KB
testcase_10 AC 161 ms
107,808 KB
testcase_11 AC 135 ms
87,036 KB
testcase_12 AC 163 ms
110,308 KB
testcase_13 AC 164 ms
110,128 KB
testcase_14 AC 165 ms
109,980 KB
testcase_15 AC 165 ms
110,264 KB
testcase_16 AC 165 ms
110,020 KB
testcase_17 AC 161 ms
109,536 KB
testcase_18 AC 162 ms
110,192 KB
testcase_19 AC 162 ms
108,892 KB
testcase_20 AC 153 ms
109,540 KB
testcase_21 AC 163 ms
110,512 KB
testcase_22 AC 166 ms
110,444 KB
testcase_23 AC 163 ms
110,352 KB
testcase_24 AC 165 ms
110,444 KB
testcase_25 AC 164 ms
110,132 KB
testcase_26 AC 163 ms
110,452 KB
testcase_27 AC 169 ms
110,976 KB
testcase_28 AC 166 ms
110,936 KB
testcase_29 AC 164 ms
110,724 KB
testcase_30 AC 163 ms
110,852 KB
testcase_31 AC 163 ms
110,980 KB
testcase_32 AC 166 ms
111,104 KB
testcase_33 AC 165 ms
110,724 KB
testcase_34 AC 165 ms
110,928 KB
testcase_35 AC 164 ms
110,764 KB
testcase_36 AC 167 ms
110,832 KB
testcase_37 AC 126 ms
81,184 KB
testcase_38 AC 155 ms
109,432 KB
testcase_39 AC 159 ms
110,480 KB
testcase_40 AC 159 ms
110,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))

data = [0 for i in range(2*10**5+1)]
for a in A:
    data[a]+=1

cum = [data[i] for i in range(2*10**5+1)]
cum_val = [i*data[i] for i in range(2*10**5+1)]
for i in range(1,2*10**5+1):
    cum[i] += cum[i-1]
    cum_val[i] += cum_val[i-1]

ans = 0
Max = 2*10**5
for i in range(1,Max+1):
    ans += data[i] * cum_val[i-1]
    for j in range(1,Max//i + 1):
        L = i*j
        R = min(i*(j+1) - 1,Max)
        ans -= i * j * (cum[R]-cum[L-1]) * data[i]
    ans += data[i] * (cum_val[Max] - cum_val[i-1])

print(ans)
0