Напоминание: в случае технических проблем любого характера, вы можете использовать m1.codeforces.com, m2.codeforces.com, m3.codeforces.com. ×

Hint needed

Правка en1, от 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

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский CodeLakVN 2024-08-20 10:57:58 527 Initial revision (published)