結果

問題 No.2218 Multiple LIS
ユーザー FromBooskaFromBooska
提出日時 2023-02-18 08:42:24
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 701 bytes
コンパイル時間 838 ms
コンパイル使用メモリ 87,288 KB
実行使用メモリ 637,776 KB
最終ジャッジ日時 2023-09-27 03:19:29
合計ジャッジ時間 14,238 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
71,808 KB
testcase_01 AC 97 ms
71,884 KB
testcase_02 AC 96 ms
71,744 KB
testcase_03 AC 94 ms
71,680 KB
testcase_04 AC 95 ms
71,844 KB
testcase_05 AC 94 ms
71,800 KB
testcase_06 AC 96 ms
71,696 KB
testcase_07 AC 96 ms
71,368 KB
testcase_08 AC 96 ms
71,704 KB
testcase_09 AC 96 ms
71,788 KB
testcase_10 AC 96 ms
71,372 KB
testcase_11 AC 95 ms
71,584 KB
testcase_12 AC 115 ms
77,764 KB
testcase_13 AC 119 ms
78,016 KB
testcase_14 AC 117 ms
78,076 KB
testcase_15 AC 114 ms
77,984 KB
testcase_16 AC 104 ms
77,456 KB
testcase_17 AC 116 ms
77,928 KB
testcase_18 AC 96 ms
71,844 KB
testcase_19 AC 106 ms
77,480 KB
testcase_20 AC 115 ms
77,964 KB
testcase_21 AC 133 ms
82,140 KB
testcase_22 AC 244 ms
97,356 KB
testcase_23 AC 365 ms
104,456 KB
testcase_24 AC 194 ms
99,516 KB
testcase_25 AC 409 ms
105,328 KB
testcase_26 AC 811 ms
113,224 KB
testcase_27 AC 879 ms
116,168 KB
testcase_28 AC 733 ms
114,252 KB
testcase_29 AC 660 ms
112,816 KB
testcase_30 AC 809 ms
113,364 KB
testcase_31 MLE -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# 先頭からdp的辞書でやるか
# 倍数約数で行ったり来たりするので間に合わない気がする

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

from collections import defaultdict
A_position = defaultdict(list)
for i in range(N):
    A_position[A[i]].append(i)
    
#print(A_position)

div = defaultdict(list)
maxA = max(A)
for i in range(N):
    for q in range(A[i], maxA+1, A[i]):
        for r in A_position[q]:
            if r > i:
                div[r].append(i)

#print(div)


dp = [0]*(N)
dp[0] = 1
mx_dic = {}
for i in range(N):
    num = A[i]
    mx = 1
    for j in div[i]:
        mx = max(mx, dp[j]+1)
    dp[i] = mx
#print(dp)

ans = max(dp)
print(ans)



0