結果
| 問題 | No.390 最長の数列 |
| コンテスト | |
| ユーザー |
oxyshower
|
| 提出日時 | 2020-01-13 19:12:56 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 478 bytes |
| 記録 | |
| コンパイル時間 | 1,662 ms |
| コンパイル使用メモリ | 186,960 KB |
| 実行使用メモリ | 11,904 KB |
| 最終ジャッジ日時 | 2026-05-28 06:02:55 |
| 合計ジャッジ時間 | 2,741 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 7 WA * 8 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
#include "LOCAL_DEBUG.hpp"
#endif
#define int long long
signed main(){
int n; cin >> n;
vector<int> a(n);
for(int i = 0; i < n; i++){
cin >> a[i];
}
sort(a.begin(),a.end());
vector<int> v(1000001, 0);
for(int i = 0; i < n; i++){
for(int j = a[i] * 2; j < 1000001; j+=a[i]){
v[j] = max(v[j], v[a[i]] + 1);
}
}
cout << *max_element(v.begin(),v.end()) << endl;
return 0;
}
oxyshower