結果
問題 | No.2219 Re:010 |
ユーザー |
![]() |
提出日時 | 2023-02-17 21:38:01 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 51 ms / 2,000 ms |
コード長 | 588 bytes |
コンパイル時間 | 3,980 ms |
コンパイル使用メモリ | 253,304 KB |
最終ジャッジ日時 | 2025-02-10 16:31:24 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <stdio.h> #include <bits/stdc++.h> #include <atcoder/all> using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000001 int main(){ string s; cin>>s; vector<mint> dp(4,0); dp[0] = 1; string t = "010"; rep(i,s.size()){ vector<mint> ndp(4,0); rep(j,2){ if(s[i]!='?'&&s[i]-'0'!=j)continue; rep(k,4){ ndp[k] += dp[k]; if(k!=3 && t[k]=='0'+j)ndp[k+1] += dp[k]; } } swap(dp,ndp); } cout<<dp[3].val()<<endl; return 0; }