No.569 Number of Paths in a 3 x N Grid
レベル :
/ AI推定難易度 : 1975
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 39
作問者 :
Ryuhei Mori
/ テスター :
はむこ
タグ : / 解いたユーザー数 39
作問者 :
はむこ
問題文最終更新日: 2026-06-25 04:00:53
English (AI translation)
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 173
(順位表)
の他の問題:
Problem Statement
The Onee-san has obtained a powerful ability and can now count the paths in a 26 x 26 grid.
However, with that ability she cannot count the paths in a 3 x 1000000000000000000 grid.
Help the Onee-san.
Here, a $3\times N$ grid is an undirected graph in which vertices, 4 vertically and $N+1$ horizontally, are connected in a lattice pattern
.
Input
N
$1\le N \le 10^{18}$
Output
Output the total number of ways to get from the top-left vertex to the bottom-right vertex of the $3\times N$ grid without visiting the same vertex twice, modulo $10^9+7$.
Sample
Sample 1
Input
1
Output
8
Sample 2
Input
2
Output
38
Sample 3
Input
100
Output
244451960
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。