結果

問題 No.578 3 x N グリッド上のサイクルのサイズ(easy)
ユーザー chocorusk
提出日時 2020-02-17 08:54:57
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 937 bytes
コンパイル時間 918 ms
コンパイル使用メモリ 108,736 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-06 14:49:01
合計ジャッジ時間 2,279 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;
ll a[]={32,316,2292,14422,84744,479004,2638328,14258574,75940592,399782668,84795558,786749020};
ll c[]={4,4,999999968,56,62,999999621,753,999999123,685,999999665,102,999999991};
int main()
{
	int n; cin>>n;
	ll v[55]={};
	for(int i=0; i<12; i++) v[i]=a[i];
	for(int i=12; i<n; i++) for(int j=0; j<12; j++) (v[i]+=(MOD-c[11-j])*v[i-j-1])%=MOD;
	cout<<v[n-1]<<endl;
	return 0;
}
0