結果
問題 |
No.390 最長の数列
|
ユーザー |
![]() |
提出日時 | 2016-07-10 06:03:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 472 bytes |
コンパイル時間 | 695 ms |
コンパイル使用メモリ | 78,008 KB |
実行使用メモリ | 10,788 KB |
最終ジャッジ日時 | 2024-10-13 09:52:54 |
合計ジャッジ時間 | 7,108 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 4 |
other | RE * 1 TLE * 1 -- * 13 |
ソースコード
#include <iostream> #include <stdio.h> #include <vector> #include <algorithm> #include <functional> using namespace std; int main(){ int N; cin >> N; vector<int> x(N); vector<int> y(N); for(int i=0;i<N;i++){ cin >> x[i]; } sort(x.begin(),x.end()); for(int i=0;i<N;i++){ y[i]=1; } int res=1; for(int i=0;i<N-1;i++){ for(int j=i+1;j<N;j++){ if((x[j] % x[i] )==0){ if(y[j]<x[i]+1){ y[j]=x[i]+1; if(res<y[j]){ res=y[j]; } } } } } return res; }