結果
問題 |
No.1702 count good string
|
ユーザー |
![]() |
提出日時 | 2021-10-08 23:29:08 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 710 bytes |
コンパイル時間 | 872 ms |
コンパイル使用メモリ | 94,680 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-23 07:34:17 |
合計ジャッジ時間 | 2,261 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 WA * 39 |
ソースコード
#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 = 1; i < int(T.size()); ++i) dp[1][i + 1] += dp[0][i]; } else { for (int d = 0; d < int(T.size()); ++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'; }