結果

問題 No.979 Longest Divisor Sequence
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2020-02-01 00:33:43
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 559 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 81,716 KB
実行使用メモリ 127,116 KB
最終ジャッジ日時 2023-10-17 14:45:56
合計ジャッジ時間 5,309 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
67,612 KB
testcase_01 AC 48 ms
67,612 KB
testcase_02 AC 48 ms
67,612 KB
testcase_03 AC 48 ms
67,612 KB
testcase_04 AC 47 ms
67,612 KB
testcase_05 AC 47 ms
67,612 KB
testcase_06 AC 48 ms
67,612 KB
testcase_07 AC 48 ms
67,612 KB
testcase_08 AC 48 ms
67,612 KB
testcase_09 AC 49 ms
67,612 KB
testcase_10 AC 86 ms
75,316 KB
testcase_11 AC 91 ms
76,548 KB
testcase_12 AC 89 ms
75,800 KB
testcase_13 AC 139 ms
125,856 KB
testcase_14 TLE -
testcase_15 AC 803 ms
101,796 KB
権限があれば一括ダウンロードができます

ソースコード

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