結果

問題 No.1233 割り切れない気持ち
ユーザー brthyyjpbrthyyjp
提出日時 2021-02-26 13:01:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 927 ms / 3,153 ms
コード長 389 bytes
コンパイル時間 310 ms
コンパイル使用メモリ 82,036 KB
実行使用メモリ 110,540 KB
最終ジャッジ日時 2024-04-10 04:08:28
合計ジャッジ時間 12,043 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,068 KB
testcase_01 AC 40 ms
53,484 KB
testcase_02 AC 43 ms
59,232 KB
testcase_03 AC 61 ms
69,072 KB
testcase_04 AC 56 ms
67,520 KB
testcase_05 AC 41 ms
58,196 KB
testcase_06 AC 41 ms
58,516 KB
testcase_07 AC 205 ms
82,840 KB
testcase_08 AC 306 ms
88,108 KB
testcase_09 AC 510 ms
100,584 KB
testcase_10 AC 567 ms
103,896 KB
testcase_11 AC 169 ms
82,148 KB
testcase_12 AC 645 ms
107,308 KB
testcase_13 AC 625 ms
107,948 KB
testcase_14 AC 604 ms
107,444 KB
testcase_15 AC 686 ms
107,744 KB
testcase_16 AC 659 ms
107,356 KB
testcase_17 AC 78 ms
97,656 KB
testcase_18 AC 927 ms
110,540 KB
testcase_19 AC 84 ms
104,448 KB
testcase_20 AC 77 ms
97,760 KB
testcase_21 AC 106 ms
105,692 KB
testcase_22 AC 105 ms
104,032 KB
testcase_23 AC 106 ms
105,008 KB
testcase_24 AC 107 ms
104,308 KB
testcase_25 AC 106 ms
105,188 KB
testcase_26 AC 107 ms
104,176 KB
testcase_27 AC 123 ms
107,264 KB
testcase_28 AC 122 ms
106,756 KB
testcase_29 AC 124 ms
107,080 KB
testcase_30 AC 122 ms
106,916 KB
testcase_31 AC 124 ms
107,272 KB
testcase_32 AC 123 ms
106,804 KB
testcase_33 AC 122 ms
106,752 KB
testcase_34 AC 123 ms
106,988 KB
testcase_35 AC 121 ms
107,320 KB
testcase_36 AC 124 ms
107,144 KB
testcase_37 AC 35 ms
53,872 KB
testcase_38 AC 114 ms
103,536 KB
testcase_39 AC 526 ms
105,248 KB
testcase_40 AC 530 ms
105,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
A.sort()

import bisect
ans = 0
memo = {}
for i, a in enumerate(A):
    if a in memo:
        ans -= memo[a]
        continue
    temp = 0
    l = i
    x = 1
    while l < n:
        r = bisect.bisect_left(A, (x+1)*a)
        temp += (r-l)*x*a
        l = r
        x += 1
    memo[a] = temp
    ans -= temp
ans += sum(A)*n
print(ans)
0