結果

問題 No.1233 割り切れない気持ち
ユーザー daikisuyamadaikisuyama
提出日時 2020-09-19 13:38:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 797 ms / 3,153 ms
コード長 533 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 111,580 KB
最終ジャッジ日時 2023-09-05 17:38:53
合計ジャッジ時間 12,809 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
70,684 KB
testcase_01 AC 74 ms
70,956 KB
testcase_02 AC 83 ms
74,700 KB
testcase_03 AC 102 ms
76,076 KB
testcase_04 AC 93 ms
75,912 KB
testcase_05 AC 77 ms
74,796 KB
testcase_06 AC 80 ms
74,952 KB
testcase_07 AC 216 ms
83,352 KB
testcase_08 AC 296 ms
88,812 KB
testcase_09 AC 504 ms
101,220 KB
testcase_10 AC 538 ms
104,364 KB
testcase_11 AC 188 ms
82,720 KB
testcase_12 AC 598 ms
108,272 KB
testcase_13 AC 587 ms
108,524 KB
testcase_14 AC 586 ms
107,748 KB
testcase_15 AC 598 ms
107,812 KB
testcase_16 AC 608 ms
108,028 KB
testcase_17 AC 114 ms
103,968 KB
testcase_18 AC 797 ms
111,580 KB
testcase_19 AC 127 ms
107,388 KB
testcase_20 AC 112 ms
104,384 KB
testcase_21 AC 140 ms
107,480 KB
testcase_22 AC 141 ms
107,092 KB
testcase_23 AC 141 ms
106,764 KB
testcase_24 AC 141 ms
107,308 KB
testcase_25 AC 139 ms
107,236 KB
testcase_26 AC 141 ms
107,488 KB
testcase_27 AC 156 ms
107,724 KB
testcase_28 AC 156 ms
107,428 KB
testcase_29 AC 156 ms
107,604 KB
testcase_30 AC 157 ms
107,468 KB
testcase_31 AC 158 ms
107,608 KB
testcase_32 AC 161 ms
107,632 KB
testcase_33 AC 157 ms
107,372 KB
testcase_34 AC 157 ms
107,340 KB
testcase_35 AC 156 ms
107,408 KB
testcase_36 AC 157 ms
107,700 KB
testcase_37 AC 76 ms
70,876 KB
testcase_38 AC 116 ms
104,204 KB
testcase_39 AC 450 ms
105,348 KB
testcase_40 AC 445 ms
105,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
a.sort()
from bisect import bisect_left,bisect_right
ans=0
d=dict()
for i in range(n):
    if a[i] in d:
        ans+=d[a[i]]
        continue
    ans_sub=0
    j=i
    #print(i)
    while j!=n:
        x=a[j]//a[i]
        b=bisect_left(a,(x+1)*a[i],lo=j)-1
        #print((x+1)*a[i])
        #print(j,b)
        #print(j,x,b-j+1)
        ans_sub+=(x*(b-j+1)*a[i])
        j=b+1
        #print(j,b)
    d[a[i]]=ans_sub
    ans+=ans_sub
#print(sum(a)*n)
#print(ans)
print(sum(a)*n-ans)
0