結果
| 問題 | 
                            No.390 最長の数列
                             | 
                    
| コンテスト | |
| ユーザー | 
                             oxyshower
                         | 
                    
| 提出日時 | 2020-01-13 19:12:56 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 478 bytes | 
| コンパイル時間 | 2,044 ms | 
| コンパイル使用メモリ | 172,052 KB | 
| 実行使用メモリ | 11,868 KB | 
| 最終ジャッジ日時 | 2024-12-21 13:51:18 | 
| 合計ジャッジ時間 | 2,780 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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