結果

問題 No.2046 Ans Mod? Mod Ans!
ユーザー first_vilfirst_vil
提出日時 2022-08-19 22:16:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 744 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 110,504 KB
最終ジャッジ日時 2023-08-22 11:42:48
合計ジャッジ時間 3,569 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
79,000 KB
testcase_01 AC 83 ms
78,828 KB
testcase_02 AC 87 ms
79,140 KB
testcase_03 AC 99 ms
79,632 KB
testcase_04 AC 94 ms
79,712 KB
testcase_05 AC 98 ms
79,460 KB
testcase_06 AC 94 ms
79,604 KB
testcase_07 AC 98 ms
79,464 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 134 ms
93,688 KB
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

int1 = lambda x: int(x) - 1

# input = lambda: sys.stdin.buffer.readline()
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
i1 = lambda: int1(input())
mi = lambda: map(int, input().split())
mi1 = lambda: map(int1, input().split())
li = lambda: list(mi())
li1 = lambda: list(mi1())
lli = lambda n: [li() for _ in range(n)]

INF = float("inf")
mod = int(1e9 + 7)
# mod = 998244353

n = ii()
a = li()
m = 200010
b = [0] * m
d = [0] * m
for x in a:
    b[x] += x
    d[x] += 1
for i in range(1, m):
    b[i] += b[i - 1]
    d[i] += d[i - 1]
ans = 0
for x in a:
    for y in range(x * 2, m, x):
        ans += x * (d[y] - d[y - x])
        ans -= (b[y - 1] - b[y - x]) - (y - x) * (d[y - 1] - d[y - x])
print(ans)
0