Balanced Neighbors

AtCoder
IDagc032_b
Time2000ms
Memory256MB
Difficulty
You are given an integer $N$. Build an undirected graph with $N$ vertices with indices $1$ to $N$ that satisfies the following two conditions: * The graph is simple and connected. * There exists an integer $S$ such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is $S$. It can be proved that at least one such graph exists under the constraints of this problem. ## Constraints * All values in input are integers. * $3 \leq N \leq 100$ ## Input Input is given from Standard Input in the following format: $N$ [samples]
Samples
Input #1
3
Output #1
2
1 3
2 3

*   For every vertex, the sum of the indices of the vertices adjacent to that vertex is $3$.
API Response (JSON)
{
  "problem": {
    "name": "Balanced Neighbors",
    "description": {
      "content": "You are given an integer $N$. Build an undirected graph with $N$ vertices with indices $1$ to $N$ that satisfies the following two conditions: *   The graph is simple and connected. *   There exists ",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "agc032_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given an integer $N$. Build an undirected graph with $N$ vertices with indices $1$ to $N$ that satisfies the following two conditions:\n\n*   The graph is simple and connected.\n*   There exists ...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments