結果

問題 No.1233 割り切れない気持ち
ユーザー tktk_snsntktk_snsn
提出日時 2022-06-06 21:55:28
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 507 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 81,780 KB
実行使用メモリ 109,448 KB
最終ジャッジ日時 2023-10-21 03:41:39
合計ジャッジ時間 25,332 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,532 KB
testcase_01 AC 38 ms
53,432 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 250 ms
104,872 KB
testcase_18 AC 1,618 ms
107,496 KB
testcase_19 WA -
testcase_20 AC 250 ms
104,872 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
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 bisect
U = 2 * 10 ** 5

N = int(input())
A = list(map(int, input().split()))
A.sort()
B = [0] * (N + 1)
for i, a in enumerate(A, 1):
    B[i] = a + B[i-1]

ans = 0
s = A[0]
for i in range(1, N):
    if A[i] != A[i-1]:
        ans += s
    s += A[i]


for i, a in enumerate(A):
    for i in range(1, U+1):
        l = bisect.bisect_left(A, i * a)
        if l >= N:
            break
        r = bisect.bisect_left(A, (i + 1) * a)
        ans += B[r] - B[l]
        ans -= a * i * (r - l)

print(ans)
0