結果

問題 No.1702 count good string
ユーザー bayashikobayashiko
提出日時 2021-10-08 23:28:53
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 1,970 bytes
コンパイル時間 5,209 ms
コンパイル使用メモリ 277,984 KB
実行使用メモリ 11,496 KB
最終ジャッジ日時 2023-09-30 13:31:51
合計ジャッジ時間 7,233 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 9 ms
11,496 KB
testcase_14 AC 9 ms
11,388 KB
testcase_15 AC 9 ms
11,348 KB
testcase_16 AC 10 ms
11,344 KB
testcase_17 AC 9 ms
11,380 KB
testcase_18 AC 9 ms
11,404 KB
testcase_19 AC 9 ms
11,344 KB
testcase_20 AC 9 ms
11,352 KB
testcase_21 AC 9 ms
11,404 KB
testcase_22 AC 9 ms
11,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 8 ms
11,404 KB
testcase_34 AC 8 ms
11,340 KB
testcase_35 AC 8 ms
11,340 KB
testcase_36 AC 9 ms
11,412 KB
testcase_37 AC 8 ms
11,412 KB
testcase_38 AC 8 ms
11,400 KB
testcase_39 AC 8 ms
11,340 KB
testcase_40 AC 8 ms
11,400 KB
testcase_41 AC 8 ms
11,376 KB
testcase_42 AC 8 ms
11,344 KB
testcase_43 AC 7 ms
11,440 KB
testcase_44 AC 8 ms
11,464 KB
testcase_45 AC 1 ms
4,376 KB
testcase_46 AC 1 ms
4,376 KB
testcase_47 AC 1 ms
4,380 KB
testcase_48 AC 1 ms
4,380 KB
testcase_49 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2")
#pragma GCC optimize("unroll-loops")
using namespace std;
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mulfloat mp::cpp_dec_float_100
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define flc(x) __builtin_popcountll(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define vec vector<lint>
#define nep(x) next_permutation(all(x))
typedef long long lint;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
const int MAX_N=3e5+5;
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
//vector<int> bucket[MAX_N/1000];
constexpr int MOD=1000000007;
//constexpr int MOD=998244353;
#include<atcoder/all>
using namespace atcoder;
typedef __int128_t llint;

int main(void){
    int N;
    string S;
    cin >> N >> S;
    using mint=modint1000000007;
    mint dp[N+1][10][2]={};
    string T="yukicoder";
    dp[0][0][0]=1;
    rep(i,N) rep(j,10) rep(k,2){
        if(j==9){
            dp[i+1][j][k]+=dp[i][j][k];
            continue;
        }
        if(k==0){
            dp[i+1][j][k]+=dp[i][j][k];
            if(T[j]==S[i]) dp[i+1][j+1][k]+=dp[i][j][k];
            else if(S[i]=='?') dp[i+1][j+1][k+1]+=dp[i][j][k];
        }
        else{
            dp[i+1][j][k]+=dp[i][j][k];
            if(T[j]==S[i]) dp[i+1][j+1][k]+=dp[i][j][k];
        }
    }
    mint ans=dp[N][9][0]+dp[N][9][1];
    cout << ans.val() << endl;
}
0