結果

問題 No.2218 Multiple LIS
ユーザー FromBooskaFromBooska
提出日時 2023-02-18 10:03:11
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 476 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 164,528 KB
最終ジャッジ日時 2023-09-27 04:08:46
合計ジャッジ時間 11,454 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
164,528 KB
testcase_01 AC 94 ms
71,636 KB
testcase_02 AC 97 ms
71,448 KB
testcase_03 AC 94 ms
71,716 KB
testcase_04 AC 98 ms
71,716 KB
testcase_05 AC 96 ms
71,444 KB
testcase_06 AC 94 ms
71,720 KB
testcase_07 AC 92 ms
71,732 KB
testcase_08 AC 97 ms
71,628 KB
testcase_09 AC 97 ms
71,464 KB
testcase_10 AC 96 ms
71,756 KB
testcase_11 AC 95 ms
71,632 KB
testcase_12 AC 112 ms
77,908 KB
testcase_13 AC 109 ms
77,696 KB
testcase_14 AC 111 ms
77,628 KB
testcase_15 AC 110 ms
77,764 KB
testcase_16 AC 106 ms
77,808 KB
testcase_17 AC 110 ms
77,596 KB
testcase_18 AC 98 ms
71,300 KB
testcase_19 AC 106 ms
77,564 KB
testcase_20 AC 111 ms
77,984 KB
testcase_21 AC 126 ms
81,972 KB
testcase_22 AC 196 ms
92,872 KB
testcase_23 AC 293 ms
95,892 KB
testcase_24 AC 160 ms
92,748 KB
testcase_25 AC 281 ms
95,812 KB
testcase_26 AC 498 ms
96,576 KB
testcase_27 AC 492 ms
96,876 KB
testcase_28 AC 458 ms
96,652 KB
testcase_29 AC 428 ms
97,000 KB
testcase_30 AC 516 ms
96,848 KB
testcase_31 TLE -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# dpでTLEした
# エラトステネスのようにやるか

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)

dp = [1]*N
maxA = max(A)
for i in range(N):
    current = dp[i]
    for q in range(A[i], maxA+1, A[i]):
        for r in A_position[q]:
            if r > i:
                dp[r] = max(dp[r], current+1)

#print(dp)

ans = max(dp)
print(ans)
0