結果

問題 No.1811 EQUIV Ten
ユーザー 蜜蜂蜜蜂
提出日時 2022-01-14 22:05:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 1,281 bytes
コンパイル時間 3,974 ms
コンパイル使用メモリ 229,140 KB
実行使用メモリ 28,484 KB
最終ジャッジ日時 2024-04-30 14:53:04
合計ジャッジ時間 5,398 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 38 ms
24,280 KB
testcase_12 AC 41 ms
25,720 KB
testcase_13 AC 43 ms
27,948 KB
testcase_14 AC 44 ms
28,484 KB
testcase_15 AC 44 ms
28,320 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 4 ms
6,940 KB
testcase_21 AC 4 ms
6,940 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 17 ms
11,932 KB
testcase_24 AC 5 ms
6,944 KB
testcase_25 AC 2 ms
6,940 KB
testcase_26 AC 13 ms
10,284 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 2 ms
6,944 KB
testcase_29 AC 2 ms
6,944 KB
testcase_30 AC 37 ms
23,564 KB
testcase_31 AC 3 ms
6,940 KB
testcase_32 AC 6 ms
6,940 KB
testcase_33 AC 6 ms
6,944 KB
testcase_34 AC 34 ms
22,568 KB
testcase_35 AC 13 ms
9,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//g++ 2.cpp -std=c++14 -O2 -I .
#include <bits/stdc++.h>
using namespace std;

#include <atcoder/all>
using namespace atcoder;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vst = vector<string>;
using vvst = vector<vst>;

#define fi first
#define se second
#define pb push_back
#define pq_big(T) priority_queue<T,vector<T>,less<T>>
#define pq_small(T) priority_queue<T,vector<T>,greater<T>>
#define all(a) a.begin(),a.end()
#define rep(i,start,end) for(ll i=start;i<(ll)(end);i++)
#define per(i,start,end) for(ll i=start;i>=(ll)(end);i--)
#define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end())

constexpr ll mod = 1e9+7;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n;
  cin>>n;

  if(n<3){
    cout<<0<<endl;
    return 0;
  }

  // n文字で1010を含む

  ll dp[n+1][16]={};

  dp[0][0]=1;

  ll ans=0;

  rep(i,1,n+1){
    rep(j,0,16){
      rep(k,0,2){
        int next=(2*j)%16+k;
        dp[i][next]+=dp[i-1][j];
        dp[i][next]%=mod;
      }
    }

    ans+=dp[i][10]*pow_mod(2,n-i,mod);
    ans%=mod;
    dp[i][10]=0;
    //cout<<ans<<endl;
  }

  ans%=mod;
  cout<<ans<<endl;
}
0