結果

問題 No.1233 割り切れない気持ち
ユーザー anagohirameanagohirame
提出日時 2020-09-18 23:57:39
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 440 bytes
コンパイル時間 493 ms
コンパイル使用メモリ 86,820 KB
実行使用メモリ 109,008 KB
最終ジャッジ日時 2023-09-04 19:50:40
合計ジャッジ時間 7,311 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
77,692 KB
testcase_01 AC 80 ms
77,532 KB
testcase_02 AC 96 ms
77,220 KB
testcase_03 AC 108 ms
77,944 KB
testcase_04 AC 107 ms
77,864 KB
testcase_05 AC 95 ms
77,552 KB
testcase_06 AC 100 ms
77,264 KB
testcase_07 AC 134 ms
84,804 KB
testcase_08 AC 142 ms
90,200 KB
testcase_09 AC 167 ms
102,128 KB
testcase_10 AC 169 ms
105,136 KB
testcase_11 AC 131 ms
83,708 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 113 ms
106,016 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 112 ms
105,712 KB
testcase_21 AC 118 ms
107,460 KB
testcase_22 AC 118 ms
107,192 KB
testcase_23 AC 119 ms
107,336 KB
testcase_24 AC 120 ms
107,192 KB
testcase_25 AC 119 ms
107,336 KB
testcase_26 AC 120 ms
107,328 KB
testcase_27 AC 125 ms
108,076 KB
testcase_28 AC 122 ms
107,884 KB
testcase_29 AC 124 ms
107,812 KB
testcase_30 AC 124 ms
107,728 KB
testcase_31 AC 125 ms
107,996 KB
testcase_32 AC 125 ms
107,812 KB
testcase_33 AC 126 ms
107,968 KB
testcase_34 AC 128 ms
107,744 KB
testcase_35 AC 122 ms
108,012 KB
testcase_36 AC 121 ms
107,712 KB
testcase_37 AC 81 ms
77,428 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
権限があれば一括ダウンロードができます

ソースコード

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):
		k = min(MAX-1, j+i)
		tmp -= i * (j//i) * (cum[k-1] - cum[j-1])
	ans += num * tmp
	s += i * num
print(ans)
0