結果

問題 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,331 ms / 4,000 ms
コード長 313 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 30,996 KB
最終ジャッジ日時 2024-05-09 17:27:55
合計ジャッジ時間 11,005 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,880 KB
testcase_01 AC 29 ms
10,880 KB
testcase_02 AC 29 ms
10,880 KB
testcase_03 AC 34 ms
10,880 KB
testcase_04 AC 32 ms
10,752 KB
testcase_05 AC 34 ms
10,880 KB
testcase_06 AC 32 ms
10,752 KB
testcase_07 AC 35 ms
10,752 KB
testcase_08 AC 57 ms
11,136 KB
testcase_09 AC 55 ms
11,264 KB
testcase_10 AC 59 ms
11,264 KB
testcase_11 AC 76 ms
11,520 KB
testcase_12 AC 73 ms
11,392 KB
testcase_13 AC 770 ms
18,748 KB
testcase_14 AC 611 ms
16,524 KB
testcase_15 AC 1,211 ms
21,612 KB
testcase_16 AC 1,296 ms
21,908 KB
testcase_17 AC 954 ms
20,168 KB
testcase_18 AC 1,010 ms
20,772 KB
testcase_19 AC 885 ms
21,000 KB
testcase_20 AC 2,331 ms
30,996 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