結果

問題 No.979 Longest Divisor Sequence
ユーザー hedwig100hedwig100
提出日時 2020-04-15 20:10:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 749 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 47,988 KB
最終ジャッジ日時 2024-04-09 18:58:17
合計ジャッジ時間 6,152 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 23 ms
10,752 KB
testcase_05 WA -
testcase_06 AC 24 ms
10,752 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 78 ms
16,232 KB
testcase_14 TLE -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7
INF = 10 ** 12
import sys
sys.setrecursionlimit(1000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from  itertools import permutations

def main():
    n = int(input())
    a = list(map(int,input().split()))

    M = max(a)
    ans = 2
    flag = False
    for i in range(2,int(M ** 0.5 + 1)):
        before = a[0]
        length = 1
        power = i
        for j in range(1,n):
            if a[j]%power == 0 and before < a[j]:
                length += 1
                power *= i
            else:
                before = min(before,a[j])
        
        if power != i:
            flag = True
        ans = max(ans,length)

    if flag == False:
        print(1)
    else:
        print(ans)

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