問題一覧 > 通常問題

No.578 Sizes of Cycles on a 3 x N Grid (easy)

レベル : / AI推定難易度 : 2100 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 19
作問者 : Ryuhei Mori / テスター : はむこ
お気に入りにしたユーザー ProblemId : 1727 / 自分の提出
問題文最終更新日: 2026-06-25 23:18:49
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 難問コンテスト (順位表) の他の問題:

Problem Statement

The undirected graph whose vertices are connected in a lattice, with 4 vertices vertically and $N+1$ vertices horizontally,

is called a $3\times N$ grid. Find the total number of "ways to choose an arbitrary vertex from the $3\times N$ grid and then choose a simple cycle containing that vertex", modulo $10^9+7$.

Input

N

$1\le N \le 50$

Output

Output the answer on a single line. Print a newline at the end.

Sample

Sample 1
Input
1
Output
32

There are 8 ways to choose a vertex. If you choose any of the top 2 or bottom 2 vertices, there are 3 simple cycles containing that vertex. If you choose any of the 4 vertices in the second or third row from the top, there are 5 simple cycles containing that vertex. The answer is 4 x 3 + 4 x 5 = 32.

For $N=2,\dotsc,10$, the answers are 316, 2292, 14422, 84744, 479004, 2638328, 14258574, 75940592, 399782668.

Sample 2
Input
20
Output
424899366

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