結果
| 問題 |
No.390 最長の数列
|
| コンテスト | |
| ユーザー |
atst5515
|
| 提出日時 | 2016-07-10 06:06:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 494 bytes |
| コンパイル時間 | 803 ms |
| コンパイル使用メモリ | 77,888 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2024-10-13 09:53:14 |
| 合計ジャッジ時間 | 7,329 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 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] &&(x[j] % x[i] )==0){
if(y[j]<y[i]+1){
y[j]=y[i]+1;
if(res<y[j]){
res=y[j];
}
}
}
}
}
cout << res << endl;
}
atst5515