結果

問題 No.2373 wa, wo, n
ユーザー V_Melville
提出日時 2023-07-07 21:54:12
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,067 bytes
コンパイル時間 3,634 ms
コンパイル使用メモリ 245,152 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-21 17:47:35
合計ジャッジ時間 4,335 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 25 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
    int n;
    cin >> n;
    
    string s;
    cin >> s;
    
    for (char c : s) {
        if (c != '?' and c != 'w' and c != 'a' and c != 'o' and c != 'n') {
            puts("No");
            return 0;
        }
    }
    
    if (n == 1) {
        if (s[0] != '?') {
            if (s[0] != 'n') {
                puts("No");
                return 0;
            }
        }
    }
    
    if (s[0] == 'o' or s[0] == 'a') {
        puts("No");
        return 0;
    }
    
    for (int i = 1; i < n; ++i) {
        if (s[i] == 'o') {
            if (s[i-1] != '?') {
                if (s[i] != 'w') {
                    puts("No");
                    return 0;
                }
            }
        }
    }
    
    for (int i = 1; i < n; ++i) {
        if (s[i] == 'a') {
            if (s[i-1] != '?') {
                if (s[i] != 'w') {
                    puts("No");
                    return 0;
                }
            }
        }
    }
    
    puts("Yes");
    
    return 0;
}
0