結果

問題 No.1233 割り切れない気持ち
ユーザー AEnAEn
提出日時 2022-12-17 19:25:46
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 441 bytes
コンパイル時間 2,205 ms
コンパイル使用メモリ 81,988 KB
実行使用メモリ 112,356 KB
最終ジャッジ日時 2024-04-28 12:50:38
合計ジャッジ時間 8,878 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
67,968 KB
testcase_01 AC 56 ms
62,080 KB
testcase_02 AC 70 ms
62,208 KB
testcase_03 AC 88 ms
65,152 KB
testcase_04 AC 85 ms
64,640 KB
testcase_05 AC 67 ms
62,848 KB
testcase_06 AC 72 ms
62,480 KB
testcase_07 AC 125 ms
79,488 KB
testcase_08 AC 130 ms
89,216 KB
testcase_09 AC 163 ms
102,784 KB
testcase_10 AC 166 ms
105,600 KB
testcase_11 AC 116 ms
78,208 KB
testcase_12 AC 176 ms
109,628 KB
testcase_13 AC 181 ms
109,312 KB
testcase_14 AC 173 ms
109,568 KB
testcase_15 AC 166 ms
109,312 KB
testcase_16 AC 170 ms
109,768 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 = list(map(int, input().split()))

cnt = [0]*(2*10**5+5)
sm = [0]*(2*10**5+5)
for i in range(N):
    cnt[A[i]] += 1
    sm[A[i]] += A[i]
for i in range(2*10**5+4):
    cnt[i+1] += cnt[i]
    sm[i+1] += sm[i]

res = 0
for i in range(N):
    if A[i]==1:continue
    m = 0
    res += sm[-1]
    for j in range(A[i],2*10**5+5,A[i]):
        m += (j//A[i])*(cnt[min(j+A[i],2*10**5+4)-1]-cnt[j-1])
    res -= A[i]*m
print(res)

0