結果

問題 No.2373 wa, wo, n
ユーザー june19312june19312
提出日時 2023-07-07 22:38:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 837 bytes
コンパイル時間 2,804 ms
コンパイル使用メモリ 86,604 KB
実行使用メモリ 101,064 KB
最終ジャッジ日時 2023-09-29 00:11:03
合計ジャッジ時間 6,111 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,344 KB
testcase_01 AC 71 ms
71,112 KB
testcase_02 AC 69 ms
71,232 KB
testcase_03 AC 70 ms
71,316 KB
testcase_04 AC 69 ms
71,416 KB
testcase_05 AC 70 ms
71,320 KB
testcase_06 AC 71 ms
71,308 KB
testcase_07 AC 72 ms
71,312 KB
testcase_08 AC 71 ms
71,152 KB
testcase_09 AC 70 ms
71,280 KB
testcase_10 AC 71 ms
71,532 KB
testcase_11 AC 68 ms
71,356 KB
testcase_12 AC 70 ms
71,360 KB
testcase_13 AC 70 ms
71,500 KB
testcase_14 AC 130 ms
100,580 KB
testcase_15 AC 85 ms
77,404 KB
testcase_16 AC 127 ms
100,744 KB
testcase_17 AC 88 ms
78,736 KB
testcase_18 AC 81 ms
76,408 KB
testcase_19 AC 75 ms
79,892 KB
testcase_20 AC 82 ms
86,724 KB
testcase_21 AC 74 ms
79,392 KB
testcase_22 AC 79 ms
82,132 KB
testcase_23 AC 106 ms
100,808 KB
testcase_24 AC 69 ms
71,368 KB
testcase_25 AC 71 ms
71,348 KB
testcase_26 AC 69 ms
71,084 KB
testcase_27 AC 69 ms
71,164 KB
testcase_28 AC 68 ms
71,088 KB
testcase_29 AC 71 ms
71,392 KB
testcase_30 AC 69 ms
71,236 KB
testcase_31 AC 69 ms
71,304 KB
testcase_32 AC 128 ms
100,836 KB
testcase_33 AC 108 ms
100,928 KB
testcase_34 AC 116 ms
100,728 KB
testcase_35 AC 110 ms
101,024 KB
testcase_36 AC 125 ms
101,064 KB
testcase_37 AC 116 ms
101,004 KB
testcase_38 AC 117 ms
101,000 KB
testcase_39 AC 114 ms
100,756 KB
testcase_40 AC 127 ms
100,800 KB
testcase_41 AC 128 ms
100,832 KB
testcase_42 AC 120 ms
100,880 KB
権限があれば一括ダウンロードができます

ソースコード

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()

if dp[-1][0]:
    print("Yes")
else:
    print("No")

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