結果
| 問題 | No.2373 wa, wo, n | 
| コンテスト | |
| ユーザー |  lam6er | 
| 提出日時 | 2025-03-20 20:21:15 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 65 ms / 2,000 ms | 
| コード長 | 745 bytes | 
| コンパイル時間 | 170 ms | 
| コンパイル使用メモリ | 82,664 KB | 
| 実行使用メモリ | 76,464 KB | 
| 最終ジャッジ日時 | 2025-03-20 20:22:56 | 
| 合計ジャッジ時間 | 3,137 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 39 | 
ソースコード
n = int(input())
s = input().strip()
state0 = True
state1 = False
for i in range(n):
    current_char = s[i]
    new_state0 = False
    new_state1 = False
    
    if state0:
        # Check if can take 'n' here
        if current_char == 'n' or current_char == '?':
            new_state0 = True
        # Check if can start a 'w' followed by 'a'/'o'
        if current_char == 'w' or current_char == '?':
            if i < n - 1:
                new_state1 = True
    
    if state1:
        # Check if current_char can be 'a' or 'o'
        if current_char in {'a', 'o', '?'}:
            new_state0 = True
    
    state0, state1 = new_state0, new_state1
    
    if not (state0 or state1):
        break
print("Yes" if state0 else "No")
            
            
            
        