結果

問題 No.2373 wa, wo, n
ユーザー erbowlerbowl
提出日時 2023-07-07 21:45:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,014 bytes
コンパイル時間 2,144 ms
コンパイル使用メモリ 204,524 KB
実行使用メモリ 17,468 KB
最終ジャッジ日時 2023-09-28 22:49:30
合計ジャッジ時間 4,201 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 WA -
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 22 ms
14,676 KB
testcase_15 AC 5 ms
4,888 KB
testcase_16 AC 22 ms
15,684 KB
testcase_17 AC 8 ms
6,472 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 10 ms
7,980 KB
testcase_20 AC 22 ms
14,488 KB
testcase_21 AC 11 ms
7,644 KB
testcase_22 AC 17 ms
10,368 KB
testcase_23 AC 25 ms
16,280 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 26 ms
17,196 KB
testcase_33 AC 27 ms
17,196 KB
testcase_34 AC 25 ms
17,268 KB
testcase_35 AC 26 ms
17,268 KB
testcase_36 AC 25 ms
17,404 KB
testcase_37 AC 24 ms
17,320 KB
testcase_38 AC 24 ms
17,252 KB
testcase_39 AC 25 ms
17,260 KB
testcase_40 AC 26 ms
17,468 KB
testcase_41 AC 26 ms
17,248 KB
testcase_42 AC 24 ms
17,264 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{
            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 = 0; i < 4; i++) {
        ok = ok || dp[n][i];
    }
    if(ok){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }
}
0