結果
問題 | No.1702 count good string |
ユーザー |
![]() |
提出日時 | 2021-10-08 23:31:01 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 715 bytes |
コンパイル時間 | 1,191 ms |
コンパイル使用メモリ | 95,044 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-23 07:40:29 |
合計ジャッジ時間 | 2,505 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 47 |
ソースコード
#include <iostream> #include <string> #include <vector> using namespace std; #include <atcoder/modint> using mint = atcoder::modint1000000007; int main() { int N; string S; cin >> N >> S; const string T = "yukicoder"; vector dp(2, vector<mint>(T.size() + 1)); dp[0][0] = 1; for (auto c : S) { if (c == '?') { for (int i = 0; i < int(T.size()); ++i) dp[1][i + 1] += dp[0][i]; } else { for (int d = int(T.size()) - 1; d >= 0; --d) { if (T[d] == c) { for (int e = 0; e < 2; ++e) dp[e][d + 1] += dp[e][d]; } } } } cout << (dp[0].back() + dp[1].back()).val() << '\n'; }