結果

問題 No.979 Longest Divisor Sequence
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2020-02-01 00:34:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 559 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 11,932 KB
実行使用メモリ 52,016 KB
最終ジャッジ日時 2023-10-17 14:48:35
合計ジャッジ時間 7,296 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
31,484 KB
testcase_01 AC 143 ms
31,484 KB
testcase_02 AC 148 ms
31,484 KB
testcase_03 AC 144 ms
31,484 KB
testcase_04 AC 141 ms
31,484 KB
testcase_05 AC 141 ms
31,484 KB
testcase_06 AC 144 ms
31,484 KB
testcase_07 AC 140 ms
31,484 KB
testcase_08 AC 139 ms
31,484 KB
testcase_09 AC 137 ms
31,484 KB
testcase_10 AC 342 ms
31,792 KB
testcase_11 AC 350 ms
31,792 KB
testcase_12 AC 346 ms
31,792 KB
testcase_13 AC 546 ms
47,572 KB
testcase_14 TLE -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

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

lis =  [ [] for i in range(3*(10**5)+1) ]
maxlen = [0] * N

for loop in range(N):

    na = A[loop]

    for i in range(int(na**0.5)+1):

        i += 1
        if na % i == 0:

            if i < na:
                for j in lis[i]:
                    maxlen[loop] = max(maxlen[loop] , maxlen[j] + 1)

            if na // i < na:
                for j in lis[na//i]:
                    maxlen[loop] = max(maxlen[loop] , maxlen[j] + 1)

    lis[na].append(loop)

#print (maxlen)
print (max(maxlen)+1)
0