結果
問題 | No.390 最長の数列 |
ユーザー | oxyshower |
提出日時 | 2019-03-02 18:52:44 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 500 bytes |
コンパイル時間 | 2,701 ms |
コンパイル使用メモリ | 177,292 KB |
実行使用メモリ | 70,812 KB |
最終ジャッジ日時 | 2023-09-05 16:56:39 |
合計ジャッジ時間 | 15,293 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,269 ms
66,032 KB |
testcase_01 | AC | 489 ms
34,568 KB |
testcase_02 | AC | 1,141 ms
65,836 KB |
testcase_03 | AC | 734 ms
52,924 KB |
testcase_04 | AC | 1,168 ms
65,828 KB |
testcase_05 | AC | 78 ms
10,244 KB |
testcase_06 | TLE | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
ソースコード
#include<bits/stdc++.h> using namespace std; #define int long long signed main(){ cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<int> x(n); for(int i = 0; i < n; i++){ cin >> x[i]; } sort(x.begin(),x.end()); map<int,int> dp; for(int i : x){ dp[i] = max(dp[i],1LL); for(int j = i*2; j <= 1000000; j+=i){ dp[j] = max(dp[j],dp[i]+1); } } int ans = 0; for(int i : x){ ans = max(ans,dp[i]); } cout << ans << endl; return 0; }