結果

問題 No.1233 割り切れない気持ち
ユーザー ntudantuda
提出日時 2021-10-08 22:35:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 478 bytes
コンパイル時間 2,797 ms
コンパイル使用メモリ 86,796 KB
実行使用メモリ 112,656 KB
最終ジャッジ日時 2023-09-30 11:31:33
合計ジャッジ時間 7,734 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
80,220 KB
testcase_01 AC 80 ms
80,232 KB
testcase_02 AC 86 ms
80,220 KB
testcase_03 AC 98 ms
80,692 KB
testcase_04 AC 95 ms
81,020 KB
testcase_05 AC 85 ms
80,384 KB
testcase_06 AC 91 ms
80,472 KB
testcase_07 AC 119 ms
87,476 KB
testcase_08 AC 127 ms
93,204 KB
testcase_09 AC 147 ms
104,608 KB
testcase_10 AC 153 ms
108,448 KB
testcase_11 AC 118 ms
86,560 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 112 ms
108,804 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 109 ms
109,092 KB
testcase_21 AC 119 ms
110,188 KB
testcase_22 AC 119 ms
110,372 KB
testcase_23 AC 118 ms
110,264 KB
testcase_24 AC 119 ms
110,356 KB
testcase_25 AC 120 ms
110,184 KB
testcase_26 AC 120 ms
110,324 KB
testcase_27 AC 121 ms
111,080 KB
testcase_28 AC 124 ms
110,876 KB
testcase_29 AC 122 ms
111,048 KB
testcase_30 AC 126 ms
110,964 KB
testcase_31 AC 124 ms
111,076 KB
testcase_32 AC 123 ms
110,848 KB
testcase_33 AC 123 ms
110,944 KB
testcase_34 AC 123 ms
111,016 KB
testcase_35 AC 127 ms
110,764 KB
testcase_36 AC 125 ms
111,120 KB
testcase_37 AC 86 ms
80,320 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

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

print(ans)
0