結果

問題 No.2373 wa, wo, n
ユーザー hiro71687k
提出日時 2023-07-12 17:24:54
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 1,384 bytes
コンパイル時間 1,909 ms
コンパイル使用メモリ 193,268 KB
最終ジャッジ日時 2025-02-15 10:05:43
ジャッジサーバーID
(参考情報)
judge2 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll mod=998244353;
ld inf=10000999999999900;
int main(){
    ll n;
    cin >> n;
    string s;
    cin >> s;
    bool ok=false;
    bool ok2=false;
    for (ll i = 0; i < s.size(); i++)
    {
        if (s[i]=='w')
        {
            if (ok)
            {
                cout << "No"<< endl;
                return 0;
            }
            ok=true;
        }else if (s[i]=='a'||s[i]=='o')
        {
            if (ok)
            {
                ok=false;
            }else{
                if (ok2)
                {
                    ok2=false;
                    continue;
                }
                cout << "No"<< endl;
                return 0;
            }
        }else if (s[i]=='n')
        {
            if (ok)
            {
                cout << "No" << endl;
                return 0;
            }
        }else if (s[i]=='?')
        {
            if (!ok)
            {
                ok2=true;
            }
        }else{
            cout << "No"<< endl;
            return 0;
        }
        if (s[i]!='w')
        {
            ok=false;
        }
        if (s[i]!='?')
        {
            ok2=false;
        }
    }
    if (ok)
    {
        cout << "No"<< endl;
        return 0;
    }
    
    cout << "Yes" << endl;
}
0