結果

問題 No.979 Longest Divisor Sequence
ユーザー convexineqconvexineq
提出日時 2021-05-05 04:02:29
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 273 ms / 2,000 ms
コード長 206 bytes
コンパイル時間 1,285 ms
コンパイル使用メモリ 86,720 KB
実行使用メモリ 131,776 KB
最終ジャッジ日時 2023-10-01 06:05:49
合計ジャッジ時間 4,045 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
80,524 KB
testcase_01 AC 89 ms
80,464 KB
testcase_02 AC 90 ms
80,480 KB
testcase_03 AC 88 ms
80,312 KB
testcase_04 AC 91 ms
80,416 KB
testcase_05 AC 89 ms
80,308 KB
testcase_06 AC 88 ms
80,572 KB
testcase_07 AC 89 ms
80,728 KB
testcase_08 AC 90 ms
80,424 KB
testcase_09 AC 89 ms
80,560 KB
testcase_10 AC 102 ms
81,156 KB
testcase_11 AC 95 ms
80,996 KB
testcase_12 AC 98 ms
81,096 KB
testcase_13 AC 168 ms
126,288 KB
testcase_14 AC 273 ms
131,776 KB
testcase_15 AC 163 ms
98,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,*a = map(int,open(0).read().split())
M = 300005
r,c = [0]*M, [0]*M
for v in a:
    if c[v] <= r[v]:
        for w in range(v*2,M,v):
            r[w] = max(r[w],r[v]+1)
        c[v] = r[v]+1
print(max(c))
0