結果

問題 No.2373 wa, wo, n
ユーザー erbowlerbowl
提出日時 2023-07-07 21:48:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 1,028 bytes
コンパイル時間 2,813 ms
コンパイル使用メモリ 206,028 KB
実行使用メモリ 17,316 KB
最終ジャッジ日時 2023-09-28 22:54:10
合計ジャッジ時間 6,169 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 25 ms
14,680 KB
testcase_15 AC 6 ms
4,836 KB
testcase_16 AC 27 ms
15,656 KB
testcase_17 AC 9 ms
6,496 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 12 ms
8,036 KB
testcase_20 AC 24 ms
14,376 KB
testcase_21 AC 12 ms
7,476 KB
testcase_22 AC 17 ms
10,452 KB
testcase_23 AC 26 ms
16,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 29 ms
17,192 KB
testcase_33 AC 29 ms
17,252 KB
testcase_34 AC 30 ms
17,196 KB
testcase_35 AC 26 ms
17,252 KB
testcase_36 AC 26 ms
17,288 KB
testcase_37 AC 25 ms
17,288 KB
testcase_38 AC 25 ms
17,176 KB
testcase_39 AC 26 ms
17,228 KB
testcase_40 AC 27 ms
17,300 KB
testcase_41 AC 27 ms
17,316 KB
testcase_42 AC 29 ms
17,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
    ll n;
    std::cin >> n;
    string s;
    std::cin >> s;
    // waon 0123
    vector<vector<bool>> dp(n+1,vector<bool>(4));
    dp[0][3]=true;
    for (int i = 0; i < n; i++) {
        if(s[i]=='w'){
            dp[i+1][0] = dp[i][1]||dp[i][2]||dp[i][3];
        }else if(s[i]=='a'){
            dp[i+1][1] = dp[i][0];
        }else if(s[i]=='o'){
            dp[i+1][2] = dp[i][0];
        }else if(s[i]=='n'){
            dp[i+1][3] = dp[i][1]||dp[i][2]||dp[i][3];
        }else if(s[i]=='?'){
            dp[i+1][0] = dp[i][1]||dp[i][2]||dp[i][3];
            dp[i+1][1] = dp[i][0];
            dp[i+1][2] = dp[i][0];
            dp[i+1][3] = dp[i][1]||dp[i][2]||dp[i][3];
        }
    }
    bool ok = false;
    for (int i = 1; i < 4; i++) {
        ok = ok || dp[n][i];
    }
    if(ok){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }
}
0