結果
問題 | No.2219 Re:010 |
ユーザー |
|
提出日時 | 2023-02-18 08:31:12 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 516 bytes |
コンパイル時間 | 1,883 ms |
コンパイル使用メモリ | 197,320 KB |
最終ジャッジ日時 | 2025-02-10 18:49:45 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; int main(){ string s; cin >> s; vector<ll> dp(4); dp[0]=1; for(auto& c : s){ vector<ll> ndp=dp; if(c=='?'){ for(auto& x : ndp) x=(x*2)%998244353; } if(c!='1'){ ndp[1]=(ndp[1]+dp[0])%998244353; ndp[3]=(ndp[3]+dp[2])%998244353; } if(c!='0'){ ndp[2]=(ndp[2]+dp[1])%998244353; } swap(ndp,dp); } cout<<dp[3]<<'\n'; }