結果

問題 No.1233 割り切れない気持ち
ユーザー tktk_snsntktk_snsn
提出日時 2022-06-06 22:18:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 177 ms / 3,153 ms
コード長 475 bytes
コンパイル時間 522 ms
コンパイル使用メモリ 81,684 KB
実行使用メモリ 111,328 KB
最終ジャッジ日時 2023-10-21 03:42:54
合計ジャッジ時間 6,027 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
55,448 KB
testcase_01 AC 42 ms
55,448 KB
testcase_02 AC 44 ms
55,448 KB
testcase_03 AC 51 ms
61,556 KB
testcase_04 AC 52 ms
61,556 KB
testcase_05 AC 44 ms
55,448 KB
testcase_06 AC 44 ms
55,448 KB
testcase_07 AC 101 ms
88,120 KB
testcase_08 AC 112 ms
97,460 KB
testcase_09 AC 150 ms
101,516 KB
testcase_10 AC 155 ms
104,248 KB
testcase_11 AC 84 ms
84,072 KB
testcase_12 AC 171 ms
107,916 KB
testcase_13 AC 173 ms
107,884 KB
testcase_14 AC 173 ms
107,916 KB
testcase_15 AC 177 ms
107,916 KB
testcase_16 AC 172 ms
107,916 KB
testcase_17 AC 89 ms
102,248 KB
testcase_18 AC 166 ms
111,328 KB
testcase_19 AC 105 ms
108,188 KB
testcase_20 AC 89 ms
102,248 KB
testcase_21 AC 97 ms
104,968 KB
testcase_22 AC 97 ms
104,968 KB
testcase_23 AC 97 ms
104,968 KB
testcase_24 AC 96 ms
104,968 KB
testcase_25 AC 96 ms
104,968 KB
testcase_26 AC 97 ms
104,968 KB
testcase_27 AC 110 ms
107,140 KB
testcase_28 AC 107 ms
107,140 KB
testcase_29 AC 107 ms
107,140 KB
testcase_30 AC 107 ms
107,140 KB
testcase_31 AC 107 ms
107,140 KB
testcase_32 AC 105 ms
107,140 KB
testcase_33 AC 106 ms
107,140 KB
testcase_34 AC 106 ms
107,140 KB
testcase_35 AC 106 ms
107,140 KB
testcase_36 AC 105 ms
107,140 KB
testcase_37 AC 43 ms
55,448 KB
testcase_38 AC 99 ms
105,372 KB
testcase_39 AC 141 ms
106,244 KB
testcase_40 AC 140 ms
106,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

N = int(input())
A = list(map(int, input().split()))
U = max(A)
S = sum(A)

B = [0] * (U + 1)
for a in A:
    B[a] += 1
for i in range(1, U+1):
    B[i] += B[i-1]

G = 0
for a, num in Counter(A).items():
    F = 0
    for i in range(1, U+1):
        L = i * a - 1
        R = (i + 1) * a - 1
        L = min(U, L)
        R = min(U, R)
        F += i * (B[R] - B[L])
        if R == U:
            break
    G += F * a * num

print(N * S - G)
0