#P6342. [CCO 2017] Vera 与道路建设
[CCO 2017] Vera 与道路建设
Description
Vera likes hiking, so she wants to build her own road network. The road network contains locations, numbered . The network consists of undirected roads connecting and . The graph is guaranteed to be connected, and multiple edges are allowed.
Vera calls two locations with a perfect pair if there exists a walk that starts from , goes to , and then returns to , such that each road is traversed at most once.
Vera thinks her road network is beautiful if it contains exactly perfect pairs.
Given , help Vera find a beautiful road network.
Input Format
The input contains one line with an integer .
Output Format
Output a beautiful road network in the following format:
- The first line contains the number of vertices and the number of edges .
- The next lines each contain two integers and , indicating that there is an edge between and ().
The order of the edges does not matter. If there are multiple beautiful road networks, you may output any one of them.
2
4 5
1 2
2 1
3 4
4 3
1 4
6
4 4
1 2
2 3
3 4
4 1
Hint
Sample Explanation
For sample , the perfect pairs are 1,2 and 3,4.
For sample , every pair of vertices is a perfect pair.
Constraints and Notes
This problem uses bundled testdata, with a total of subtasks.
- Subtask 1 (12 points): .
- Subtask 2 (24 points): .
- Subtask 3 (64 points): .
For all testdata, it is guaranteed that and .
Source: CCO 2017 Day 1 “Vera and Trail Building”.
Note: This translation is from LOJ.
Translated by ChatGPT 5
京公网安备 11011102002149号