結果

問題 No.390 最長の数列
ユーザー E31415926E31415926
提出日時 2016-11-06 14:13:56
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,480 bytes
コンパイル時間 1,660 ms
コンパイル使用メモリ 171,120 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-08-16 13:59:15
合計ジャッジ時間 8,480 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 37 ms
4,376 KB
testcase_06 TLE -
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 <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define rep(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()
#define all(a) (a).begin(),(a).end()
#define EXIST(s,e) (find(all(s),(e))!=(s).end())
#define exist(s,e) (find(all(s),(e))!=(s).end())
#define INF (1<<25)
#define ll long long
#define vs vector<string>
#define vi vector<int>
#define vi2 vector<vector<int>>
#define vll vector<ll>
#define vll2 vector<vector<ll>>
#define vb vector<bool>
#define v2Resize(s,x,y) s.resize(x); REP(i,s.size()) s[i].resize(y);
#define v2Fill(s,v) REP(i,s.size()) fill(all(s[i]),v);

#define V vector
#define Pii pair<int,int>
#define P pair;
#define in(x) cin>>x;
#define in1(x,m) REP(i,m){int tmp; cin>>tmp; x.push_back(tmp);}
#define in2(v2,x,y) REP(i,x) REP(j,y) cin>>v2[i][j];
#define OUT2(v2) REP(i,v2.size()){ REP(j,v2[i].size()){ cout<<v2[i][j] << " ";}cout<<endl;};
const int mod = 1000000007;
int dy4[] = {0, 0, 1, -1};
int dx4[] = {1, -1, 0, 0};
int dx8[] = {0,1,1,1,0,-1,-1,-1};
int dy8[] = {-1,-1,0,1,1,1,0,-1};

int n;
vi x;
vi dp;

int main() {
	in(n);
	in1(x, n);
	sort(all(x));
	dp.resize(n);
	rep(i,n) {
		int m = 0;
		rep(j,i) {
			if (x[j] * 2 > x[i])break;
			if (x[i] % x[j] == 0) {
				m = max(m, dp[j]);
			}
		}
		dp[i] = m + 1;
	}
	cout << *max_element(all(dp)) << endl;
}
0