結果

問題 No.2373 wa, wo, n
ユーザー tamatotamato
提出日時 2023-07-07 21:35:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 713 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 87,304 KB
実行使用メモリ 85,972 KB
最終ジャッジ日時 2023-09-28 22:34:43
合計ジャッジ時間 5,814 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,328 KB
testcase_01 AC 69 ms
71,092 KB
testcase_02 AC 70 ms
71,404 KB
testcase_03 AC 67 ms
71,160 KB
testcase_04 AC 71 ms
71,468 KB
testcase_05 AC 66 ms
71,556 KB
testcase_06 AC 71 ms
71,396 KB
testcase_07 AC 73 ms
71,556 KB
testcase_08 AC 68 ms
71,240 KB
testcase_09 AC 68 ms
71,232 KB
testcase_10 AC 69 ms
71,292 KB
testcase_11 AC 67 ms
71,228 KB
testcase_12 AC 67 ms
71,268 KB
testcase_13 AC 68 ms
71,072 KB
testcase_14 AC 120 ms
83,640 KB
testcase_15 AC 77 ms
76,632 KB
testcase_16 AC 129 ms
84,804 KB
testcase_17 AC 93 ms
78,472 KB
testcase_18 AC 84 ms
76,452 KB
testcase_19 AC 83 ms
77,172 KB
testcase_20 AC 83 ms
78,844 KB
testcase_21 AC 80 ms
77,088 KB
testcase_22 AC 82 ms
77,716 KB
testcase_23 AC 83 ms
79,352 KB
testcase_24 AC 69 ms
71,352 KB
testcase_25 AC 69 ms
71,112 KB
testcase_26 AC 71 ms
71,300 KB
testcase_27 AC 70 ms
71,292 KB
testcase_28 AC 69 ms
71,364 KB
testcase_29 AC 70 ms
71,300 KB
testcase_30 AC 69 ms
71,492 KB
testcase_31 AC 66 ms
71,696 KB
testcase_32 AC 125 ms
85,352 KB
testcase_33 AC 82 ms
79,476 KB
testcase_34 AC 124 ms
85,760 KB
testcase_35 AC 80 ms
79,192 KB
testcase_36 AC 115 ms
85,972 KB
testcase_37 AC 97 ms
84,784 KB
testcase_38 AC 110 ms
85,460 KB
testcase_39 AC 121 ms
85,912 KB
testcase_40 AC 119 ms
85,816 KB
testcase_41 AC 119 ms
85,884 KB
testcase_42 AC 101 ms
82,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
mod = 998244353

N = int(input())
S = input().rstrip('\n')

S = list(S)
for i in range(N):
    if S[i] == "?":
        if i > 0:
            if S[i - 1] == "w":
                S[i] = "a"
        if i != N - 1:
            if S[i + 1] == "a" or S[i + 1] == "o":
                S[i] = "w"

while S:
    if len(S) == 1:
        if S[0] == "?" or S[0] == "n":
            S.pop()
        else:
            print("No")
            exit()
    else:
        if S[-2:] == ["w", "a"] or S[-2:] == ["w", "o"]:
            S.pop()
            S.pop()
        elif S[-1] == "n" or S[-1] == "?":
            S.pop()
        else:
            print("No")
            exit()
print("Yes")
0