結果

問題 No.2218 Multiple LIS
ユーザー KudeKude
提出日時 2023-02-17 21:40:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 287 ms / 3,000 ms
コード長 436 bytes
コンパイル時間 736 ms
コンパイル使用メモリ 86,840 KB
実行使用メモリ 108,864 KB
最終ジャッジ日時 2023-09-26 18:55:21
合計ジャッジ時間 10,707 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 151 ms
90,548 KB
testcase_01 AC 153 ms
90,428 KB
testcase_02 AC 154 ms
90,216 KB
testcase_03 AC 149 ms
90,300 KB
testcase_04 AC 174 ms
90,428 KB
testcase_05 AC 152 ms
90,520 KB
testcase_06 AC 152 ms
90,376 KB
testcase_07 AC 151 ms
90,288 KB
testcase_08 AC 152 ms
90,492 KB
testcase_09 AC 152 ms
90,488 KB
testcase_10 AC 155 ms
90,472 KB
testcase_11 AC 149 ms
90,424 KB
testcase_12 AC 148 ms
90,676 KB
testcase_13 AC 155 ms
90,520 KB
testcase_14 AC 156 ms
90,460 KB
testcase_15 AC 150 ms
90,372 KB
testcase_16 AC 147 ms
90,404 KB
testcase_17 AC 155 ms
90,400 KB
testcase_18 AC 152 ms
90,428 KB
testcase_19 AC 154 ms
90,652 KB
testcase_20 AC 158 ms
90,580 KB
testcase_21 AC 190 ms
91,092 KB
testcase_22 AC 214 ms
98,948 KB
testcase_23 AC 236 ms
102,728 KB
testcase_24 AC 203 ms
95,216 KB
testcase_25 AC 246 ms
103,920 KB
testcase_26 AC 284 ms
108,764 KB
testcase_27 AC 266 ms
108,524 KB
testcase_28 AC 287 ms
108,616 KB
testcase_29 AC 266 ms
108,620 KB
testcase_30 AC 270 ms
108,604 KB
testcase_31 AC 228 ms
108,504 KB
testcase_32 AC 250 ms
108,068 KB
testcase_33 AC 248 ms
107,940 KB
testcase_34 AC 244 ms
107,996 KB
testcase_35 AC 248 ms
108,240 KB
testcase_36 AC 188 ms
103,224 KB
testcase_37 AC 225 ms
108,864 KB
testcase_38 AC 160 ms
90,236 KB
testcase_39 AC 161 ms
90,376 KB
testcase_40 AC 211 ms
108,464 KB
testcase_41 AC 235 ms
108,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
M = 10 ** 5 + 1
B = 320
d = [0] * M
divs = [[] for _ in range(M)]
for x in range(1, B):
    for y in range(x, M, x):
        divs[y].append(x)
a = list(map(int, input().split()))
ans = 0
for x in reversed(a):
    if x >= B:
        v = max((d[b] for b in range(x, M, x)), default = 0) + 1
        d[x] = v
    else:
        v = d[x] + 1
    ans = max(ans, v)
    for y in divs[x]:
        d[y] = max(d[y], v)
print(ans)
0