結果

問題 No.1233 割り切れない気持ち
ユーザー titiatitia
提出日時 2020-09-19 04:11:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 395 bytes
コンパイル時間 1,099 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 46,260 KB
最終ジャッジ日時 2023-09-05 03:16:03
合計ジャッジ時間 37,968 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 427 ms
20,432 KB
testcase_01 AC 113 ms
16,028 KB
testcase_02 AC 726 ms
16,076 KB
testcase_03 AC 1,671 ms
31,832 KB
testcase_04 AC 1,340 ms
31,908 KB
testcase_05 AC 880 ms
16,172 KB
testcase_06 AC 986 ms
16,204 KB
testcase_07 AC 2,482 ms
34,364 KB
testcase_08 AC 2,352 ms
35,768 KB
testcase_09 AC 2,448 ms
39,876 KB
testcase_10 AC 2,530 ms
40,232 KB
testcase_11 AC 2,197 ms
33,964 KB
testcase_12 AC 2,733 ms
41,792 KB
testcase_13 AC 2,473 ms
41,748 KB
testcase_14 AC 2,539 ms
41,704 KB
testcase_15 AC 2,775 ms
41,636 KB
testcase_16 AC 2,703 ms
41,572 KB
testcase_17 AC 194 ms
34,856 KB
testcase_18 TLE -
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 #

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