結果

問題 No.2373 wa, wo, n
ユーザー june19312june19312
提出日時 2023-07-07 22:36:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 797 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 82,548 KB
実行使用メモリ 103,284 KB
最終ジャッジ日時 2024-07-21 18:49:43
合計ジャッジ時間 3,981 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 38 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()

dp = []

for i in range(N+1):
    dp.append([False]*2)

dp[0][0] = True

#0 = a,o,n
#1 = w

for i,v in enumerate(S):
    if v == "w":
        if dp[i][0] == True:
            dp[i+1][1] = True
        else:
            print("No")
            exit()
    elif v == "a" or v == "o":
        if dp[i][1] == True:
            dp[i+1][0] = True
        else:
            print("No")
            exit()
    elif v == "n":
        if dp[i][0] == True:
            dp[i+1][0] = True
        else:
            print("No")
            exit()
    elif v == "?":
        if dp[i][0] == True:
            dp[i+1][0] = True
            dp[i+1][1] = True
        else:
            dp[i+1][0] = True
    else:
        print("No")
        exit()

print("Yes")

#print(*dp, sep = "\n")
0