第二回 AtCoder Japan Open -予選- (AtCoder Regular Contest 207 (Div.1))
B
Balanced Neighbors 2
AtCoder
⌀ 1979
原题
← AC →
翻译中…

Problem Statement

翻译中…

You are given an integer $N$. Determine whether there exists a simple connected undirected graph with $N$ vertices numbered $1$ to $N$ that satisfies the following condition, and if it exists, show one such graph.

翻译中…
  • There exists an integer $X$ such that for any vertex $v$, the sum of the numbers of all vertices other than $v$ that can be reached from $v$ by traversing an edge once or twice is $X$.
翻译中…

Constraints

翻译中…
  • $2 \le N \le 200$
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N

翻译中…

Output

翻译中…

If there does not exist a simple connected undirected graph with $N$ vertices satisfying the condition in the problem statement, print -1. If it exists, print the number of edges $M$ on the first line. On the $i$-th of the following $M$ lines, print two integers. These represent the vertex numbers of the endpoints of the $i$-th edge.

翻译中…

Any constructed graph that satisfies the condition will be accepted.

翻译中…

样例

Input #1
12
Output #1
24
1 2
2 3
3 1
1 4
4 5
5 1
2 6
6 8
8 2
3 7
7 9
9 3
4 6
6 10
10 4
5 7
7 11
11 5
8 9
9 12
12 8
10 11
11 12
12 10
Input #2
2
Output #2
-1
If there does not exist a graph satisfying the condition, print `-1`.
题目信息
题号
arc207_b
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。