結果

問題 No.2373 wa, wo, n
ユーザー karinohitokarinohito
提出日時 2023-07-07 21:59:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 703 bytes
コンパイル時間 2,260 ms
コンパイル使用メモリ 205,796 KB
実行使用メモリ 17,664 KB
最終ジャッジ日時 2024-07-21 17:58:06
合計ジャッジ時間 3,968 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 24 ms
14,848 KB
testcase_15 AC 6 ms
5,376 KB
testcase_16 AC 26 ms
15,872 KB
testcase_17 AC 8 ms
6,528 KB
testcase_18 AC 3 ms
5,376 KB
testcase_19 AC 11 ms
7,936 KB
testcase_20 AC 22 ms
14,464 KB
testcase_21 AC 10 ms
7,680 KB
testcase_22 AC 16 ms
10,624 KB
testcase_23 AC 26 ms
16,304 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 3 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 28 ms
17,536 KB
testcase_33 AC 27 ms
17,536 KB
testcase_34 AC 27 ms
17,596 KB
testcase_35 AC 26 ms
17,436 KB
testcase_36 AC 27 ms
17,536 KB
testcase_37 AC 26 ms
17,664 KB
testcase_38 AC 27 ms
17,536 KB
testcase_39 AC 27 ms
17,408 KB
testcase_40 AC 27 ms
17,408 KB
testcase_41 AC 28 ms
17,400 KB
testcase_42 AC 27 ms
17,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vll =vector<ll>;
using vvll =vector<vll>;
#define rep(i,n) for(ll i=(ll)(0); i<(ll(n)); ++i)
#define all(x) (x).begin(), (x).end()

int main(){
    ll N;
    string S;
    cin>>N>>S;
    vector<vector<bool>> DP(N+1,vector<bool>(2));
    DP[0][0]=1;
    rep(i,N){
        if(DP[i][0]){
            if(S[i]=='?'||S[i]=='n'){
                DP[i+1][0]=1;
            }
            if(S[i]=='?'||S[i]=='w'){
                DP[i+1][1]=1;
            }
        }
        if(DP[i][1]){
            if(S[i]=='?'||S[i]=='a'||S[i]=='o'){
                DP[i+1][0]=1;
            }
        }
    }
    cout<<(DP[N][0]?"Yes":"No")<<endl;
}
0