結果

問題 No.2046 Ans Mod? Mod Ans!
ユーザー ニックネームニックネーム
提出日時 2022-08-19 22:50:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,800 ms / 4,000 ms
コード長 313 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 10,692 KB
実行使用メモリ 29,980 KB
最終ジャッジ日時 2023-08-22 11:46:12
合計ジャッジ時間 12,023 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,104 KB
testcase_01 AC 17 ms
8,224 KB
testcase_02 AC 16 ms
8,336 KB
testcase_03 AC 21 ms
8,436 KB
testcase_04 AC 19 ms
8,316 KB
testcase_05 AC 22 ms
8,344 KB
testcase_06 AC 19 ms
8,300 KB
testcase_07 AC 21 ms
8,268 KB
testcase_08 AC 44 ms
8,696 KB
testcase_09 AC 43 ms
8,668 KB
testcase_10 AC 47 ms
8,912 KB
testcase_11 AC 62 ms
8,928 KB
testcase_12 AC 61 ms
8,996 KB
testcase_13 AC 838 ms
16,780 KB
testcase_14 AC 642 ms
14,936 KB
testcase_15 AC 1,345 ms
20,572 KB
testcase_16 AC 1,480 ms
20,892 KB
testcase_17 AC 1,109 ms
18,952 KB
testcase_18 AC 1,160 ms
19,680 KB
testcase_19 AC 990 ms
19,604 KB
testcase_20 AC 2,800 ms
29,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate
from bisect import bisect_left
n = int(input())
a = sorted(map(int, input().split()))
b = list(accumulate(a[::-1]))
m = max(a)
ans = 0
for i, v in enumerate(a[:-1]):
    ans += 2*v*(n-i-1)-b[n-i-2]
    for j in range(2, m//v+1):
        ans += v*(n-bisect_left(a, v*j))
print(ans)
0