結果

問題 No.2218 Multiple LIS
ユーザー qibqib
提出日時 2023-03-16 18:52:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 702 ms / 3,000 ms
コード長 464 bytes
コンパイル時間 209 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 91,300 KB
最終ジャッジ日時 2023-10-18 13:08:29
合計ジャッジ時間 9,681 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
57,840 KB
testcase_01 AC 42 ms
57,840 KB
testcase_02 AC 41 ms
57,840 KB
testcase_03 AC 41 ms
57,840 KB
testcase_04 AC 41 ms
57,840 KB
testcase_05 AC 41 ms
57,840 KB
testcase_06 AC 40 ms
57,840 KB
testcase_07 AC 42 ms
57,840 KB
testcase_08 AC 41 ms
57,840 KB
testcase_09 AC 42 ms
57,840 KB
testcase_10 AC 42 ms
57,840 KB
testcase_11 AC 42 ms
57,840 KB
testcase_12 AC 46 ms
60,484 KB
testcase_13 AC 55 ms
65,308 KB
testcase_14 AC 60 ms
65,304 KB
testcase_15 AC 53 ms
63,244 KB
testcase_16 AC 44 ms
60,484 KB
testcase_17 AC 55 ms
65,308 KB
testcase_18 AC 42 ms
57,840 KB
testcase_19 AC 44 ms
60,484 KB
testcase_20 AC 53 ms
65,292 KB
testcase_21 AC 80 ms
67,632 KB
testcase_22 AC 235 ms
81,408 KB
testcase_23 AC 360 ms
85,216 KB
testcase_24 AC 121 ms
73,824 KB
testcase_25 AC 391 ms
86,444 KB
testcase_26 AC 527 ms
91,240 KB
testcase_27 AC 533 ms
91,240 KB
testcase_28 AC 531 ms
91,240 KB
testcase_29 AC 537 ms
91,240 KB
testcase_30 AC 544 ms
91,240 KB
testcase_31 AC 205 ms
90,408 KB
testcase_32 AC 243 ms
90,408 KB
testcase_33 AC 202 ms
90,408 KB
testcase_34 AC 204 ms
90,408 KB
testcase_35 AC 243 ms
90,404 KB
testcase_36 AC 69 ms
85,120 KB
testcase_37 AC 690 ms
91,300 KB
testcase_38 AC 41 ms
57,840 KB
testcase_39 AC 42 ms
57,840 KB
testcase_40 AC 701 ms
91,012 KB
testcase_41 AC 702 ms
91,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

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

m = 10 ** 5
dp = [0 for _ in range(n)]
idx = [None for _ in range(m + 1)]
for i in range(n):
  for x in range(1, int(math.sqrt(a[i])) + 1):
    if a[i] % x == 0:
      if not idx[x] is None:
        dp[i] = max(dp[i], dp[idx[x]] + 1)
      if x != a[i] // x and not idx[a[i] // x] is None:
        dp[i] = max(dp[i], dp[idx[a[i] // x]] + 1)

  dp[i] = max(dp[i], 1)
  idx[a[i]] = i

print(max(dp))
0