| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 1024 MB | 36 | 24 | 21 | 70.000% |
In this problem, you have to construct a bipartite graph which has the following properties:
Recall that a bipartite graph is a graph where the vertices are divided into two parts so that each edge connects a vertex from the first part and a vertex from the second part. A perfect matching is a collection of edges such that each vertex of the graph is an end of exactly one edge from that collection.
The first line contains an integer $T$, the number of test cases ($1 \le T \le 100$). Each of the next $T$ lines contains an integer $d$, the number of vertices in the corresponding test case ($3 \le d \le 100$).
For each test case, start by printing an integer $m$, the number of edges, on a separate line. On the next $m$ lines, print the edge descriptions. Each edge description is a pair of integers $u$ and $v$: the numbers of vertices of the first and the second part connected by that edge ($0 \le u < d$, $0 \le v < d - 2$).
The graph must not contain multiple edges.
1 4
7 0 1 1 0 1 1 2 0 2 1 3 0 3 1
You do not need to minimize the number of edges.