結果

問題 No.2219 Re:010
ユーザー kaichou243kaichou243
提出日時 2023-02-18 08:29:37
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 503 bytes
コンパイル時間 2,153 ms
コンパイル使用メモリ 201,164 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-27 03:10:25
合計ジャッジ時間 3,523 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 11 ms
4,380 KB
testcase_19 AC 10 ms
4,376 KB
testcase_20 WA -
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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*=2;
        }
        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';
}
0