結果

問題 No.390 最長の数列
ユーザー tamatotamato
提出日時 2020-05-21 23:58:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 531 ms / 5,000 ms
コード長 479 bytes
コンパイル時間 509 ms
コンパイル使用メモリ 82,576 KB
実行使用メモリ 111,572 KB
最終ジャッジ日時 2024-04-10 08:37:51
合計ジャッジ時間 3,742 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
66,632 KB
testcase_01 AC 70 ms
66,744 KB
testcase_02 AC 80 ms
67,000 KB
testcase_03 AC 70 ms
66,060 KB
testcase_04 AC 83 ms
66,728 KB
testcase_05 AC 96 ms
107,780 KB
testcase_06 AC 531 ms
111,364 KB
testcase_07 AC 64 ms
67,680 KB
testcase_08 AC 53 ms
65,820 KB
testcase_09 AC 64 ms
68,168 KB
testcase_10 AC 163 ms
111,460 KB
testcase_11 AC 169 ms
111,376 KB
testcase_12 AC 172 ms
111,572 KB
testcase_13 AC 151 ms
103,776 KB
testcase_14 AC 369 ms
111,512 KB
testcase_15 AC 53 ms
66,796 KB
testcase_16 AC 55 ms
65,952 KB
testcase_17 AC 68 ms
70,764 KB
testcase_18 AC 80 ms
73,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


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

    N = int(input())
    X = list(map(int, input().split()))
    X = set(X)

    A = [1] * (10**6+1)
    for i in range(1, 10**6+1):
        if i in X:
            for j in range(2, 10**6+1):
                if i*j > 10**6:
                    break
                if i*j in X:
                    A[i*j] = max(A[i*j], A[i] + 1)
    print(max(A))


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