結果

問題 No.1702 count good string
ユーザー kabipoyokabipoyo
提出日時 2021-10-20 18:44:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 107 ms / 2,000 ms
コード長 1,348 bytes
コンパイル時間 3,884 ms
コンパイル使用メモリ 233,096 KB
実行使用メモリ 10,484 KB
最終ジャッジ日時 2023-10-20 11:06:53
合計ジャッジ時間 8,064 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 103 ms
10,484 KB
testcase_14 AC 100 ms
10,484 KB
testcase_15 AC 104 ms
10,484 KB
testcase_16 AC 104 ms
10,484 KB
testcase_17 AC 102 ms
10,484 KB
testcase_18 AC 102 ms
10,484 KB
testcase_19 AC 104 ms
10,484 KB
testcase_20 AC 107 ms
10,484 KB
testcase_21 AC 104 ms
10,484 KB
testcase_22 AC 100 ms
10,484 KB
testcase_23 AC 3 ms
4,348 KB
testcase_24 AC 3 ms
4,348 KB
testcase_25 AC 3 ms
4,348 KB
testcase_26 AC 3 ms
4,348 KB
testcase_27 AC 3 ms
4,348 KB
testcase_28 AC 3 ms
4,348 KB
testcase_29 AC 3 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 3 ms
4,348 KB
testcase_32 AC 2 ms
4,348 KB
testcase_33 AC 96 ms
10,484 KB
testcase_34 AC 97 ms
10,484 KB
testcase_35 AC 99 ms
10,484 KB
testcase_36 AC 97 ms
10,484 KB
testcase_37 AC 100 ms
10,484 KB
testcase_38 AC 99 ms
10,484 KB
testcase_39 AC 98 ms
10,484 KB
testcase_40 AC 98 ms
10,484 KB
testcase_41 AC 95 ms
10,484 KB
testcase_42 AC 95 ms
10,484 KB
testcase_43 AC 90 ms
10,484 KB
testcase_44 AC 89 ms
10,484 KB
testcase_45 AC 1 ms
4,348 KB
testcase_46 AC 2 ms
4,348 KB
testcase_47 AC 2 ms
4,348 KB
testcase_48 AC 2 ms
4,348 KB
testcase_49 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef int64_t lint;
#define rep(i, n) for(int i=0; i<n; i++)
#define repx(i, l, n) for(int i=l; i<n; i++)
#define all(v) v.begin(), v.end()
#define show(x) cout << #x << ": " << x << endl;
#define list(x) cout << #x << ": " << x << "  ";
#define pb push_back
using vi = vector<lint>;
using vvi = vector<vector<lint>>;
template<class T> inline void vin(vector<T>& v) { rep(i, v.size()) cin >> v.at(i); }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline void drop(T x) { cout << x << endl; exit(0); }
template<class T> void vout(vector<T> v) { rep(i, v.size()) { cout << v.at(i) << ' '; } cout << endl; }
constexpr lint LINF = LLONG_MAX/2;
using mint = modint1000000007;
using vm = vector<mint>;

int main() {
	lint N;
	string S;
	cin >> N >> S;

	mint a=0, b=0, c=0, x, y, z;
	rep(t, 10) {
		string s = "yukicoder";
		if (t < s.size()) s[t] = '?';
		std::vector<vm> dp(N+1, vm(10));
		dp[0][0] = 1;
		rep(i, N) {
			rep(j, 10) {
				dp[i+1][j] += dp[i][j];
				if (j < 9) {
					if (S[i] == s[j]) dp[i+1][j+1] += dp[i][j];
				}
			}
		}
		a += dp[N][9];
	}
	std::cout << a.val() << '\n';
}
0