問題一覧 > 通常問題

No.690 E869120 and Constructing Array 4

レベル : / AI推定難易度 : 1100 / 実行時間制限 : 1ケース 1.000秒 / メモリ制限 : 256 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : (AC するまで非表示) / 解いたユーザー数 84
作問者 : e869120 / テスター : Pulmn
お気に入りにしたユーザー ProblemId : 1686 / 自分の提出
問題文最終更新日: 2026-06-26 06:08:09
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 191 (順位表) の他の問題:

Problem Statement

Output one graph satisfying the following conditions. (What even is an Array...)

  • It is a directed graph with $N$ vertices and $M$ edges, where edge $i$ ($1 \leq i \leq M$) goes from vertex $d1_i$ to vertex $d2_i$. It must satisfy $d1_i < d2_i$.
  • The number of ways to go from vertex $1$ to vertex $N$ (the number of paths starting at vertex $1$ and ending at vertex $N$) is exactly $K$.
  • It must satisfy $1 \leq N \leq 32$. Also, if $i \neq j$, at least one of $d1_i \neq d1_j$ and $d2_i \neq d2_j$ must hold.

Input

K

An integer $K$ between $0$ and $10^{9}$, inclusive, is given on $1$ line.

Output

$N$ $M$
$d1_1$ $d2_1$
$d1_2$ $d2_2$
...
$d1_M$ $d2_M$

On line $1$, output the number of vertices $N$ and the number of edges $M$ of the graph.
On the $M$ lines starting from line $2$, output the information of the edges of the graph.
Print a newline at the end.

Sample

Sample 1
Input
2
Output
3 3
1 2
1 3
2 3

There are 2 ways to go: 1 -> 3 and 1 -> 2 -> 3.

Sample 2
Input
3
Output
5 6
1 2
2 3
3 4
4 5
1 5
2 4

Sample 3
Input
12
Output
9 15
1 2
1 3
2 3
2 4
2 8
3 5
4 6
4 7
5 6
5 7
5 8
6 8
6 9
7 9
8 9

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。