Divide-and-conquer on Tree
题号:NC225767
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
Special Judge, 64bit IO Format: %lld

题目描述

Cuber QQ has challenged you with the task to construct a binary tree with root 1, and no more than 5000 nodes, along with a divide-and-conquer strategy, such that the recursive depth d of your divide-and-conquer strategy is at least 2 levels less than the strategy based on sizes of subtrees.

The recursive depth d of a function is defined as the maximum number of functions ever appeared in the call stack (see the return value of the pseudo-code below for a formal definition).

The divide-and-conquer strategy based on subtree sizes is shown as below:



Note: In this pseudo-code, T_u denotes a subtree in T whose root is u.

输入描述:

No input.

输出描述:

In the first line, output an positive integer n (), which is the node number of your binary tree.

In the following n-1 lines, output u_i and v_i in the i-th line, denoting an edge connecting u_i and v_i.

Cuber QQ will delete the edge one by one in the order that you give in the output, starting from (u_1, v_1), and recursively handle the subtrees.