結果
問題 | No.2218 Multiple LIS |
ユーザー | FromBooska |
提出日時 | 2023-02-18 10:42:23 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 693 bytes |
コンパイル時間 | 370 ms |
コンパイル使用メモリ | 87,096 KB |
実行使用メモリ | 848,400 KB |
最終ジャッジ日時 | 2023-09-27 04:35:17 |
合計ジャッジ時間 | 4,424 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 76 ms
71,500 KB |
testcase_01 | AC | 79 ms
71,324 KB |
testcase_02 | AC | 78 ms
71,332 KB |
testcase_03 | AC | 76 ms
71,280 KB |
testcase_04 | AC | 77 ms
71,624 KB |
testcase_05 | AC | 77 ms
71,276 KB |
testcase_06 | AC | 78 ms
71,328 KB |
testcase_07 | AC | 76 ms
71,356 KB |
testcase_08 | AC | 77 ms
71,584 KB |
testcase_09 | AC | 77 ms
71,136 KB |
testcase_10 | AC | 77 ms
71,424 KB |
testcase_11 | AC | 81 ms
75,836 KB |
testcase_12 | AC | 88 ms
76,256 KB |
testcase_13 | AC | 91 ms
76,872 KB |
testcase_14 | AC | 94 ms
76,516 KB |
testcase_15 | AC | 90 ms
76,628 KB |
testcase_16 | AC | 82 ms
76,116 KB |
testcase_17 | AC | 93 ms
76,700 KB |
testcase_18 | AC | 80 ms
75,812 KB |
testcase_19 | AC | 83 ms
76,248 KB |
testcase_20 | AC | 93 ms
76,616 KB |
testcase_21 | MLE | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
ソースコード
# 公式解説 # dp[i][j]:= Aiまで見て最後に選んだ数がjのときの最長部分列の長さ N = int(input()) A = list(map(int, input().split())) maxA = max(A) dp = [[0]*(maxA+1) for i in range(N+1)] for i in range(1, N+1): num = A[i-1] for j in range(maxA+1): if j != num: dp[i][j] = dp[i-1][j] elif j == num: mx = 0 for k in range(1, j+1): if k*k > j: break if j%k == 0: mx = max(mx, dp[i-1][k]) mx = max(mx, dp[i-1][j//k]) dp[i][j] = mx+1 #print(dp[i]) #print(dp) ans = max(dp[N]) print(ans)