#P16637. 春季限定独立集问题

    ID: 19000 远端评测题 2000ms 512MiB 尝试: 0 已通过: 0 显示难度NOI/NOI+/CTS 上传者: 标签>贪心递推数论整除分块线性筛法

春季限定独立集问题

Background

Problem Description

There is a rooted tree with nn nodes, and the root is 11.

For i>1i > 1, let mim_i be the smallest prime factor of ii. Then the parent of node ii is imi\frac{i}{m_i}.

Find the size of the maximum independent set of this tree.

Input Format

One line with a non-negative integer nn, representing the number of nodes in the tree.

Output Format

One line with a non-negative integer, representing the size of the maximum independent set of this tree.

7
4
114514
68372
10000000000
5971085299

Hint

Constraints

  • For 10%10\% of the testdata, 1≤n≤1071 \leq n \leq 10^7.
  • For 30%30\% of the testdata, 1≤n≤1081 \leq n \leq 10^8.
  • For 50%50\% of the testdata, 1≤n≤1091 \leq n \leq 10^{9}.
  • For 70%70\% of the testdata, 1≤n≤10101 \leq n \leq 10^{10}.
  • For 100%100\% of the testdata, 1≤n≤10111 \leq n \leq 10^{11}.

Translated by ChatGPT 5