結果
問題 |
No.1702 count good string
|
ユーザー |
![]() |
提出日時 | 2025-06-10 05:32:56 |
言語 | C++17(gnu拡張) (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,018 bytes |
コンパイル時間 | 4,226 ms |
コンパイル使用メモリ | 258,024 KB |
実行使用メモリ | 62,080 KB |
最終ジャッジ日時 | 2025-06-10 05:33:06 |
合計ジャッジ時間 | 8,486 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 WA * 42 |
ソースコード
//#include <monsterenergy> #include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; using mint = modint998244353; typedef long long ll; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() const int MAX = 1e9; const int MIN = -1*1e9; const ll MAXLL = 1e18; const ll MINLL = -1*1e18; const string Y = "yukicoder"; int main() { int N; cin >> N; string S; cin >> S; vector DP(N+1,vector(10,vector<mint>(2))); DP[0][0][0] = 1; for(int i = 0; i < N; i++) { for(int j = 0; j < 9; j++) { if(S[i] == '?') { DP[i+1][j+1][1] += DP[i][j][0]; } else if(S[i] == Y[j]) { DP[i+1][j+1][0] += DP[i][j][0]; DP[i+1][j+1][1] += DP[i][j][1]; } DP[i+1][j][1] += DP[i][j][1]; DP[i+1][j][0] += DP[i][j][0]; } } cout << (DP[N][9][0]+DP[N][9][1]).val() << endl; return 0; }