結果

問題 No.1233 割り切れない気持ち
ユーザー titiatitia
提出日時 2020-09-19 04:13:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 291 ms / 3,153 ms
コード長 377 bytes
コンパイル時間 1,375 ms
コンパイル使用メモリ 86,576 KB
実行使用メモリ 119,660 KB
最終ジャッジ日時 2023-09-05 03:17:32
合計ジャッジ時間 10,695 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
116,324 KB
testcase_01 AC 115 ms
116,176 KB
testcase_02 AC 142 ms
116,480 KB
testcase_03 AC 176 ms
116,596 KB
testcase_04 AC 155 ms
116,836 KB
testcase_05 AC 148 ms
116,308 KB
testcase_06 AC 153 ms
116,284 KB
testcase_07 AC 232 ms
118,692 KB
testcase_08 AC 227 ms
116,900 KB
testcase_09 AC 236 ms
114,660 KB
testcase_10 AC 249 ms
117,232 KB
testcase_11 AC 205 ms
117,784 KB
testcase_12 AC 253 ms
119,224 KB
testcase_13 AC 247 ms
119,660 KB
testcase_14 AC 241 ms
119,484 KB
testcase_15 AC 251 ms
119,176 KB
testcase_16 AC 262 ms
119,256 KB
testcase_17 AC 143 ms
117,176 KB
testcase_18 AC 291 ms
119,456 KB
testcase_19 AC 150 ms
119,144 KB
testcase_20 AC 152 ms
117,164 KB
testcase_21 AC 153 ms
116,152 KB
testcase_22 AC 148 ms
116,088 KB
testcase_23 AC 149 ms
116,352 KB
testcase_24 AC 150 ms
116,196 KB
testcase_25 AC 146 ms
116,368 KB
testcase_26 AC 147 ms
116,208 KB
testcase_27 AC 153 ms
118,876 KB
testcase_28 AC 154 ms
118,772 KB
testcase_29 AC 151 ms
119,096 KB
testcase_30 AC 153 ms
118,992 KB
testcase_31 AC 155 ms
118,744 KB
testcase_32 AC 150 ms
119,056 KB
testcase_33 AC 151 ms
119,084 KB
testcase_34 AC 151 ms
118,716 KB
testcase_35 AC 151 ms
118,884 KB
testcase_36 AC 151 ms
118,740 KB
testcase_37 AC 115 ms
116,252 KB
testcase_38 AC 152 ms
117,272 KB
testcase_39 AC 233 ms
119,136 KB
testcase_40 AC 234 ms
118,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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

U=[0]*(5*10**5+1)
for a in A:
    U[a]+=1

from itertools import accumulate
ACC=list(accumulate(U))

ANS=0

for i in range(5*10**5+1):
    if U[i]==0:
        continue

    ANS+=S*U[i]
    for j in range(i+i-1,5*10**5+1,i):
        ANS-=U[i]*i*(ACC[j]-ACC[j-i])*(j//i)

print(ANS)
0