"CF 566F" clique in the divisibility Graph

Source: Internet
Author: User

"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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.