SOLVE

LATER

The Tree

Problem

Editorial

Analytics

Paheli and Bhoojo are Appro’s long lost friends . The Last time Appro met them was in class 10th science class. Appro sees them after 6 years today but they are very angry with her , so they punish her and ask her to calculate strength of the tree in their backyard.

Strength of a tree is defined as maximum sum of number of divisors of subset of nodes of a tree but there is one condition , if a node is included in this set, none of its children can be a part.

Please help Appro with this.

Note: The tree is rooted at 1.

**Input:**

The first line of input contains single integer $$N$$ denoting the number of nodes in the tree.

Next $$N-1$$ lines contains 2 space separated integers $$A$$ and $$B$$ denoting that there is an edge from node $$A$$ to node $$B$$.

**Output:**

Print the required answer.

**Constraints:**

$$ 1\le N \le 10^6 $$

$$ 1\le A,B \le N $$

Time Limit:
1.0 sec(s)
for each input file.

Memory Limit:
256 MB

Source Limit:
1024 KB

Marking Scheme:
Marks are awarded when all the testcases pass.

Allowed Languages:
C,
C++,
Clojure,
C#,
D,
Erlang,
F#,
Go,
Groovy,
Haskell,
Java,
Java 8,
JavaScript(Rhino),
JavaScript(Node.js),
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala,
Scala 2.11.8,
Swift,
Visual Basic

Initializing Code Editor...

{"057676d": "/pagelets/show-submission/algorithm/the-tree/", "05767a7": "/pagelets/problem-author-tester/algorithm/the-tree/", "05767bd": "/pagelets/problems-hint/algorithm/the-tree/", "0576790": "/pagelets/suggested-problems/algorithm/the-tree/", "05767d3": "/pagelets/recommended-problems/algorithm/the-tree/"}

{}

realtime.hackerearth.com

80

9c23da25fb45367fb9e73cd6949ea12bc21decf9

58a29e5cae2309f04b28

/realtime/pusher/auth/