結果

問題 No.390 最長の数列
ユーザー JunOnumaJunOnuma
提出日時 2017-05-22 11:01:28
言語 Python2
(2.7.18)
結果
AC  
実行時間 3,373 ms / 5,000 ms
コード長 294 bytes
コンパイル時間 47 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 50,216 KB
最終ジャッジ日時 2024-04-10 10:21:22
合計ジャッジ時間 15,481 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 606 ms
45,812 KB
testcase_01 AC 371 ms
46,016 KB
testcase_02 AC 547 ms
45,872 KB
testcase_03 AC 425 ms
45,868 KB
testcase_04 AC 558 ms
45,880 KB
testcase_05 AC 277 ms
50,216 KB
testcase_06 AC 3,373 ms
50,200 KB
testcase_07 AC 381 ms
45,872 KB
testcase_08 AC 207 ms
45,944 KB
testcase_09 AC 379 ms
46,060 KB
testcase_10 AC 560 ms
50,032 KB
testcase_11 AC 603 ms
50,080 KB
testcase_12 AC 573 ms
50,104 KB
testcase_13 AC 878 ms
49,156 KB
testcase_14 AC 3,300 ms
50,084 KB
testcase_15 AC 205 ms
46,100 KB
testcase_16 AC 205 ms
45,888 KB
testcase_17 AC 216 ms
46,268 KB
testcase_18 AC 224 ms
46,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(raw_input())
l = map(int, raw_input().split())
ll = [0 for _ in range(10**6+1)]
for i in l:
    ll[i] = 1
for i,j in enumerate(ll):
    if j == 0:
        continue
    k = i*2
    while k <= 10**6:
        if ll[k] != 0:
            ll[k] = max(ll[k], j+1)
        k += i
print max(ll)
0