結果

問題 No.1917 LCMST
ユーザー tamatotamato
提出日時 2022-04-29 21:42:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 725 bytes
コンパイル時間 615 ms
コンパイル使用メモリ 86,912 KB
実行使用メモリ 261,132 KB
最終ジャッジ日時 2023-09-11 12:39:56
合計ジャッジ時間 45,149 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 252 ms
100,464 KB
testcase_01 AC 239 ms
100,384 KB
testcase_02 AC 291 ms
100,620 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 246 ms
100,324 KB
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 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 948 ms
259,760 KB
testcase_30 AC 929 ms
261,132 KB
testcase_31 AC 921 ms
260,756 KB
testcase_32 AC 933 ms
258,748 KB
testcase_33 AC 926 ms
260,820 KB
testcase_34 AC 730 ms
250,300 KB
testcase_35 AC 589 ms
250,276 KB
testcase_36 AC 823 ms
250,144 KB
testcase_37 AC 953 ms
258,712 KB
testcase_38 AC 926 ms
258,604 KB
testcase_39 AC 945 ms
259,088 KB
testcase_40 AC 928 ms
257,524 KB
testcase_41 AC 954 ms
259,136 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353
NN = 10 ** 5


def main():
    import sys
    input = sys.stdin.readline

    div = [[] for _ in range(NN + 1)]
    for d in range(1, NN + 1):
        for x in range(1, NN + 1):
            if d * x > NN:
                break
            div[d * x].append(d)

    N = int(input())
    A = list(map(int, input().split()))

    A.sort()
    ans = 0
    seen = [10 ** 17] * (NN + 1)

    a = A[0]
    for d in div[a]:
        seen[d] = min(seen[d], a // d)

    for a in A[1:]:
        mi = 10 ** 17
        for d in div[a][::-1]:
            mi = min(mi, seen[d])
        ans += a * mi
        for d in div[a]:
            seen[d] = min(seen[d], a // d)

    print(ans)


if __name__ == '__main__':
    main()
0