結果

問題 No.2218 Multiple LIS
ユーザー no way
提出日時 2023-02-18 12:12:21
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 142 ms / 3,000 ms
コード長 302 bytes
コンパイル時間 1,599 ms
コンパイル使用メモリ 165,392 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 23:29:03
合計ジャッジ時間 4,234 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int f[N];
int n,x,ans;
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("%d",&x);
		int t=0;
		for (int j=1;j*j<=x;j++) if (x%j==0){
			t=max(t,max(f[j],f[x/j]));
		}
		f[x]=t+1;
		ans=max(ans,t+1);
	}
	printf("%d\n",ans);
}
0