結果

問題 No.1233 割り切れない気持ち
ユーザー H3PO4H3PO4
提出日時 2022-07-01 08:32:12
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 477 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 81,984 KB
実行使用メモリ 117,872 KB
最終ジャッジ日時 2024-05-04 03:50:02
合計ジャッジ時間 10,917 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
59,104 KB
testcase_01 AC 34 ms
52,276 KB
testcase_02 AC 34 ms
52,756 KB
testcase_03 AC 40 ms
62,112 KB
testcase_04 AC 44 ms
62,384 KB
testcase_05 AC 37 ms
53,840 KB
testcase_06 AC 34 ms
52,560 KB
testcase_07 AC 63 ms
81,232 KB
testcase_08 AC 78 ms
91,804 KB
testcase_09 AC 104 ms
104,000 KB
testcase_10 AC 110 ms
107,596 KB
testcase_11 AC 59 ms
79,792 KB
testcase_12 AC 120 ms
112,140 KB
testcase_13 AC 125 ms
112,192 KB
testcase_14 AC 121 ms
112,332 KB
testcase_15 AC 121 ms
112,284 KB
testcase_16 AC 123 ms
111,916 KB
testcase_17 AC 73 ms
102,056 KB
testcase_18 AC 114 ms
112,020 KB
testcase_19 AC 95 ms
112,140 KB
testcase_20 AC 77 ms
102,528 KB
testcase_21 AC 79 ms
103,180 KB
testcase_22 AC 80 ms
103,356 KB
testcase_23 AC 81 ms
102,944 KB
testcase_24 AC 80 ms
103,756 KB
testcase_25 AC 78 ms
103,568 KB
testcase_26 AC 78 ms
103,356 KB
testcase_27 AC 580 ms
111,740 KB
testcase_28 AC 544 ms
111,792 KB
testcase_29 AC 268 ms
111,528 KB
testcase_30 AC 247 ms
111,468 KB
testcase_31 AC 240 ms
111,816 KB
testcase_32 AC 234 ms
111,344 KB
testcase_33 AC 223 ms
111,804 KB
testcase_34 AC 214 ms
111,480 KB
testcase_35 AC 213 ms
111,500 KB
testcase_36 AC 201 ms
111,612 KB
testcase_37 AC 33 ms
52,672 KB
testcase_38 TLE -
testcase_39 -- -
testcase_40 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.buffer.readline

N = int(input())
A = tuple(map(int, input().split()))
MAX = max(A)
A_freq = [0] * (MAX + 1)
for a in A:
    A_freq[a] += 1
A_freq_acc = [0] * (MAX + 1)
for i in range(1, MAX + 1):
    A_freq_acc[i] = A_freq_acc[i - 1] + A_freq[i]

ans = N * sum(A)
for a in A:
    div_sum = 0
    for i, x in enumerate(range(a - 1, MAX, a), 1):
        div_sum += i * (A_freq_acc[min(x + a, MAX)] - A_freq_acc[x])
    ans -= a * div_sum
print(ans)
0