Hint needed

Revision en1, by CodeLakVN, 2024-08-20 10:57:58

Hi, please help me to solve this problem. Given a graph with N (<= 2e5) vertices (1..N). Between 2 vertices i and j will have an edge if i < j and gcd(i, j) > 1. The value of node i is a[i] (<= 1e9). We have to find a set of nodes S, such that for each any 2 nodes x and y in S, there is no edge between them, and the total value of nodes in S is maximum. For example: we have N = 6 nodes, and a[6] = {1, 2, 1, 3, 1, 6}, then S will be {1, 5, 6} then the total value of S is 1 + 1 + 6 = 8 is as maximum as possible

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English CodeLakVN 2024-08-20 10:57:58 527 Initial revision (published)