"CF 566F" clique in the divisibility Graph
DP for maximum cluster model
The number of numerator can be the number of a couple of ways to ask the largest regiment (maximum complete sub-chart)
Using the longest common subsequence procedure DP out the longest road because a number of approximations is also the number of the approximate so as long as it can be linked to a complete sub-graph
The code is as follows:
#include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>#include <algorithm>#include <queue>#include <vector>#include <cmath>#define LL Long Long#define INF 0x3f3f3f3fusing namespace STD;intdp[1111111];intMain () {memset(DP,0,sizeof(DP));intN,X,MM =0, I,j;scanf("%d", &n); for(i =0; I < n; ++i) {scanf("%d", &x); MM = Max (mm,dp[x]+1); for(j =2; J*x <=1000000; ++J) {Dp[j*x] = max (dp[j*x],dp[x]+1); } dp[x]++; }printf("%d\n", MM);return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
"CF 566F" clique in the divisibility Graph