結果

問題 No.1233 割り切れない気持ち
ユーザー WSKRWSKR
提出日時 2020-09-21 22:35:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 935 ms / 3,153 ms
コード長 820 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 111,100 KB
最終ジャッジ日時 2023-09-07 02:44:05
合計ジャッジ時間 18,369 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
79,584 KB
testcase_01 AC 106 ms
79,412 KB
testcase_02 AC 173 ms
79,628 KB
testcase_03 AC 345 ms
80,000 KB
testcase_04 AC 210 ms
80,484 KB
testcase_05 AC 184 ms
79,612 KB
testcase_06 AC 195 ms
79,752 KB
testcase_07 AC 624 ms
86,572 KB
testcase_08 AC 632 ms
92,460 KB
testcase_09 AC 606 ms
104,552 KB
testcase_10 AC 662 ms
107,788 KB
testcase_11 AC 345 ms
86,060 KB
testcase_12 AC 699 ms
110,080 KB
testcase_13 AC 638 ms
110,332 KB
testcase_14 AC 654 ms
109,944 KB
testcase_15 AC 707 ms
110,012 KB
testcase_16 AC 723 ms
110,196 KB
testcase_17 AC 138 ms
107,788 KB
testcase_18 AC 935 ms
110,080 KB
testcase_19 AC 131 ms
108,852 KB
testcase_20 AC 153 ms
107,924 KB
testcase_21 AC 163 ms
110,680 KB
testcase_22 AC 162 ms
110,556 KB
testcase_23 AC 159 ms
110,564 KB
testcase_24 AC 158 ms
110,772 KB
testcase_25 AC 157 ms
110,908 KB
testcase_26 AC 156 ms
110,788 KB
testcase_27 AC 161 ms
111,052 KB
testcase_28 AC 163 ms
110,712 KB
testcase_29 AC 161 ms
110,844 KB
testcase_30 AC 159 ms
110,824 KB
testcase_31 AC 161 ms
111,064 KB
testcase_32 AC 163 ms
110,780 KB
testcase_33 AC 160 ms
110,584 KB
testcase_34 AC 161 ms
110,812 KB
testcase_35 AC 159 ms
110,744 KB
testcase_36 AC 161 ms
111,100 KB
testcase_37 AC 93 ms
79,604 KB
testcase_38 AC 158 ms
108,056 KB
testcase_39 AC 556 ms
109,028 KB
testcase_40 AC 561 ms
108,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left, bisect_right


def cnt_quotient(Number, quioitent, List):
    return len(List) - bisect_right(List, Number*quioitent-1)


def main():
    N = int(input())
    a = list(map(int, input().split()))
    a.sort()
    res = 0
    s = sum(a)
    visited = [False for i in range(2*10**5+1)]
    val = [0 for i in range(2*10**5+1)]
    for v in a:
        if visited[v] == True:
            res += val[v]
            continue
        else:
            visited[v] = True
            tmp_sum = s
            for i in range(1, 2*10**5+1):
                if v*i > 2*10**5:
                    break
                else:
                    tmp_sum -= v*cnt_quotient(v, i, a)
            res += tmp_sum
            val[v] = tmp_sum
    print(res)
    return


if __name__ == "__main__":
    main()

0