Balanced Neighbors 2

AtCoder
IDarc207_b
Time2000ms
Memory256MB
Difficulty
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$ [samples]
Samples
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`.
API Response (JSON)
{
  "problem": {
    "name": "Balanced Neighbors 2",
    "description": {
      "content": "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 on",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc207_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "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 on...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments