結果

問題 No.1233 割り切れない気持ち
ユーザー anagohirameanagohirame
提出日時 2020-09-18 23:58:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 190 ms / 3,153 ms
コード長 430 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 87,360 KB
実行使用メモリ 109,200 KB
最終ジャッジ日時 2023-09-04 21:58:16
合計ジャッジ時間 7,690 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
77,768 KB
testcase_01 AC 87 ms
77,828 KB
testcase_02 AC 98 ms
77,720 KB
testcase_03 AC 111 ms
78,308 KB
testcase_04 AC 112 ms
78,000 KB
testcase_05 AC 99 ms
77,820 KB
testcase_06 AC 104 ms
77,920 KB
testcase_07 AC 141 ms
84,808 KB
testcase_08 AC 147 ms
90,596 KB
testcase_09 AC 173 ms
102,240 KB
testcase_10 AC 176 ms
105,220 KB
testcase_11 AC 136 ms
83,880 KB
testcase_12 AC 179 ms
108,976 KB
testcase_13 AC 181 ms
108,900 KB
testcase_14 AC 177 ms
108,972 KB
testcase_15 AC 177 ms
108,864 KB
testcase_16 AC 179 ms
108,868 KB
testcase_17 AC 120 ms
106,004 KB
testcase_18 AC 190 ms
108,916 KB
testcase_19 AC 127 ms
109,200 KB
testcase_20 AC 119 ms
106,120 KB
testcase_21 AC 128 ms
107,876 KB
testcase_22 AC 128 ms
107,520 KB
testcase_23 AC 128 ms
107,760 KB
testcase_24 AC 128 ms
107,612 KB
testcase_25 AC 128 ms
107,492 KB
testcase_26 AC 126 ms
107,588 KB
testcase_27 AC 130 ms
108,464 KB
testcase_28 AC 129 ms
108,300 KB
testcase_29 AC 130 ms
108,040 KB
testcase_30 AC 130 ms
108,124 KB
testcase_31 AC 136 ms
108,232 KB
testcase_32 AC 132 ms
108,068 KB
testcase_33 AC 131 ms
108,140 KB
testcase_34 AC 131 ms
108,224 KB
testcase_35 AC 131 ms
108,012 KB
testcase_36 AC 132 ms
108,124 KB
testcase_37 AC 88 ms
77,816 KB
testcase_38 AC 119 ms
106,384 KB
testcase_39 AC 168 ms
108,084 KB
testcase_40 AC 165 ms
107,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))

MAX = 200001
cum = [0 for _ in range(MAX)]
for x in a:
	cum[x] += 1
for i in range(1, MAX):
	cum[i] += cum[i-1]

ans = 0
tot = sum(a)
s = cum[1]
for i in range(2, MAX):
	num = cum[i] - cum[i-1]
	if num == 0:
		continue
	ans += num * s
	tmp = tot - s
	for j in range(i, MAX, i):
		tmp -= i * (j//i) * (cum[min(j+i, MAX)-1] - cum[j-1])
	ans += num * tmp
	s += i * num
print(ans)
0