結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
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];
    }
   }
  }
 }
}
return res;

}
0