結果

問題 No.2373 wa, wo, n
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-07-07 23:06:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 148 ms / 2,000 ms
コード長 688 bytes
コンパイル時間 1,148 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 77,960 KB
最終ジャッジ日時 2023-09-29 00:49:12
合計ジャッジ時間 7,915 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,352 KB
testcase_01 AC 75 ms
70,956 KB
testcase_02 AC 74 ms
71,068 KB
testcase_03 AC 75 ms
71,268 KB
testcase_04 AC 75 ms
71,268 KB
testcase_05 AC 76 ms
71,480 KB
testcase_06 AC 75 ms
71,268 KB
testcase_07 AC 76 ms
71,068 KB
testcase_08 AC 74 ms
71,424 KB
testcase_09 AC 74 ms
70,904 KB
testcase_10 AC 76 ms
71,204 KB
testcase_11 AC 74 ms
71,212 KB
testcase_12 AC 76 ms
71,204 KB
testcase_13 AC 75 ms
71,304 KB
testcase_14 AC 144 ms
77,804 KB
testcase_15 AC 123 ms
77,292 KB
testcase_16 AC 136 ms
77,356 KB
testcase_17 AC 129 ms
77,312 KB
testcase_18 AC 98 ms
76,552 KB
testcase_19 AC 79 ms
75,608 KB
testcase_20 AC 82 ms
76,596 KB
testcase_21 AC 80 ms
75,916 KB
testcase_22 AC 78 ms
75,636 KB
testcase_23 AC 82 ms
76,584 KB
testcase_24 AC 74 ms
70,956 KB
testcase_25 AC 75 ms
71,208 KB
testcase_26 AC 75 ms
71,208 KB
testcase_27 AC 75 ms
71,480 KB
testcase_28 AC 74 ms
71,224 KB
testcase_29 AC 74 ms
71,352 KB
testcase_30 AC 74 ms
71,408 KB
testcase_31 AC 75 ms
71,096 KB
testcase_32 AC 148 ms
77,960 KB
testcase_33 AC 84 ms
76,740 KB
testcase_34 AC 133 ms
77,208 KB
testcase_35 AC 83 ms
76,636 KB
testcase_36 AC 114 ms
77,300 KB
testcase_37 AC 99 ms
77,092 KB
testcase_38 AC 100 ms
77,216 KB
testcase_39 AC 91 ms
77,312 KB
testcase_40 AC 141 ms
77,544 KB
testcase_41 AC 144 ms
77,800 KB
testcase_42 AC 114 ms
77,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
S = input()

l = ["wa","wo","n"]

dp = set()
if S[0] == "w":
    dp.add(S[0])
elif S[0] == "n":
    dp.add(S[0])

elif S[0] == "?":
    dp.add("w")
    dp.add("n")


for s in S[1:]:

    ndp = set()

    for x in dp:
        if x == "n" or x == "a" or x == "o":
            if s == "n" or s == "w":
                ndp.add(s)
            elif s == "?":
                ndp.add("n")
                ndp.add("w")
        elif x == "w":
            if s == "a" or s == "o":
                ndp.add(s)
            elif s == "?":
                ndp.add("a")
                ndp.add("o")

    dp = ndp

print("Yes" if ("a" in dp or "n" in dp or "o" in dp) else "No")
        
0