結果

問題 No.390 最長の数列
ユーザー atst5515atst5515
提出日時 2016-07-10 06:04:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 481 bytes
コンパイル時間 1,053 ms
コンパイル使用メモリ 78,740 KB
実行使用メモリ 9,344 KB
最終ジャッジ日時 2024-04-21 11:13:40
合計ジャッジ時間 7,931 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 1 ms
5,376 KB
testcase_04 WA -
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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];
    }
   }
  }
 }
}
cout << res << endl;

}
0