結果

問題 No.1233 割り切れない気持ち
ユーザー uni_pythonuni_python
提出日時 2020-09-20 15:57:12
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 974 bytes
コンパイル時間 513 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 109,284 KB
最終ジャッジ日時 2023-09-06 16:21:31
合計ジャッジ時間 16,606 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
75,772 KB
testcase_01 AC 76 ms
71,220 KB
testcase_02 AC 81 ms
75,268 KB
testcase_03 AC 93 ms
76,180 KB
testcase_04 AC 94 ms
75,656 KB
testcase_05 AC 80 ms
75,180 KB
testcase_06 AC 81 ms
75,236 KB
testcase_07 AC 278 ms
83,480 KB
testcase_08 AC 426 ms
89,148 KB
testcase_09 AC 759 ms
101,708 KB
testcase_10 AC 811 ms
105,256 KB
testcase_11 AC 245 ms
82,956 KB
testcase_12 AC 942 ms
108,528 KB
testcase_13 AC 958 ms
109,284 KB
testcase_14 AC 920 ms
108,624 KB
testcase_15 AC 901 ms
108,752 KB
testcase_16 AC 893 ms
108,888 KB
testcase_17 AC 219 ms
105,492 KB
testcase_18 AC 872 ms
107,600 KB
testcase_19 AC 205 ms
107,532 KB
testcase_20 AC 107 ms
105,252 KB
testcase_21 AC 233 ms
108,464 KB
testcase_22 AC 232 ms
108,112 KB
testcase_23 AC 232 ms
108,064 KB
testcase_24 AC 252 ms
108,184 KB
testcase_25 AC 231 ms
108,556 KB
testcase_26 AC 231 ms
108,564 KB
testcase_27 TLE -
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
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

"""
A[i]=aを見る時
aより小さい数は全部そのまま足す,
aより大きく,2aより小さいものは全部足して,個数*aを引く
此の要領で
"""
def main():
    import bisect
    
    mod=10**9+7
    N=I()
    A=LI()
    A.sort()
    M=A[-1]
    S=[0]*(N+1)
    
    for i in range(N):
        S[i+1]=S[i]+A[i]
        

        
    def calc(a):
        if a==1:
            return 0
    
        
        res=0
        now=a
        num1=0
        while now<=M+a:
            num2=bisect.bisect_left(A,now)
            temp=S[num2] - S[num1]
            temp-=(num2-num1)*(now-a)
            res+=temp
            
            num1=num2
            now+=a
        return res
    
    ans=0
    for a in A:
        ans+=calc(a)
        
    print(ans)
            
            


main()
0