結果

問題 No.1233 割り切れない気持ち
ユーザー ntudantuda
提出日時 2021-10-08 21:34:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 404 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 86,792 KB
実行使用メモリ 112,100 KB
最終ジャッジ日時 2023-09-30 09:27:57
合計ジャッジ時間 9,362 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
80,280 KB
testcase_01 AC 87 ms
80,172 KB
testcase_02 AC 92 ms
80,028 KB
testcase_03 AC 105 ms
80,776 KB
testcase_04 AC 99 ms
80,740 KB
testcase_05 AC 97 ms
80,092 KB
testcase_06 AC 97 ms
80,524 KB
testcase_07 AC 130 ms
87,520 KB
testcase_08 AC 134 ms
93,088 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 115 ms
86,572 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 118 ms
108,920 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 123 ms
108,840 KB
testcase_21 AC 126 ms
110,372 KB
testcase_22 AC 128 ms
110,116 KB
testcase_23 AC 128 ms
110,236 KB
testcase_24 AC 129 ms
110,268 KB
testcase_25 AC 124 ms
110,260 KB
testcase_26 AC 125 ms
110,236 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 89 ms
80,272 KB
testcase_38 AC 120 ms
108,912 KB
testcase_39 WA -
testcase_40 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
M = 200001
D = [0] * M
DS = [0] * M
S = [0] * M
for a in A:
    D[a] += 1

for i in range(1,M):
    S[i] = S[i-1] + i * D[i]
    DS[i] = DS[i-1]+D[i]

ans = 0
for i in range(1,M):
    if D[i] > 0:
        ans+= S[i-1] * D[i]
        for j in range(1,M//i):
            ans += D[i] * (S[i*(j+1)-1]-S[i*j] - i * j * (DS[i*(j+1)-1] - DS[i*j]))

print(ans)
0