結果
| 問題 |
No.390 最長の数列
|
| コンテスト | |
| ユーザー |
kurenai3110
|
| 提出日時 | 2016-08-19 07:55:39 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 496 bytes |
| コンパイル時間 | 552 ms |
| コンパイル使用メモリ | 65,152 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-07 19:42:20 |
| 合計ジャッジ時間 | 3,691 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 3 WA * 1 RE * 11 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int DP[100001];
int main() {
int n;
cin >> n;
vector<int> x;
x.resize(n);
rep(i, n) {
cin >> x[i];
}
sort(x.begin(), x.end());
rep(i, n) {
int resource = DP[x[i]];
for (int j = 2*x[i]; j < 100001;j+=x[i]) {
DP[j] = max(DP[j],resource+1);
}
}
int mx = 0;
for (int i = 0; i < 100001; i++) {
mx = max(mx, DP[i]);
}
cout << mx << endl;
return 0;
}
kurenai3110