結果

問題 No.2373 wa, wo, n
ユーザー flygonflygon
提出日時 2023-07-07 21:45:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 612 bytes
コンパイル時間 1,163 ms
コンパイル使用メモリ 86,788 KB
実行使用メモリ 79,824 KB
最終ジャッジ日時 2023-09-28 22:49:38
合計ジャッジ時間 7,120 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,756 KB
testcase_01 AC 97 ms
71,804 KB
testcase_02 AC 95 ms
71,756 KB
testcase_03 AC 97 ms
71,656 KB
testcase_04 AC 98 ms
71,868 KB
testcase_05 AC 97 ms
71,536 KB
testcase_06 AC 99 ms
71,656 KB
testcase_07 AC 98 ms
71,320 KB
testcase_08 AC 97 ms
71,868 KB
testcase_09 AC 97 ms
71,660 KB
testcase_10 AC 97 ms
71,716 KB
testcase_11 AC 97 ms
71,820 KB
testcase_12 AC 97 ms
71,504 KB
testcase_13 AC 98 ms
71,668 KB
testcase_14 AC 138 ms
79,232 KB
testcase_15 AC 116 ms
77,740 KB
testcase_16 AC 128 ms
79,436 KB
testcase_17 AC 116 ms
77,684 KB
testcase_18 AC 114 ms
77,448 KB
testcase_19 AC 119 ms
77,748 KB
testcase_20 AC 126 ms
79,248 KB
testcase_21 AC 119 ms
77,772 KB
testcase_22 AC 121 ms
78,336 KB
testcase_23 AC 130 ms
79,620 KB
testcase_24 AC 97 ms
71,596 KB
testcase_25 AC 96 ms
71,664 KB
testcase_26 AC 98 ms
71,700 KB
testcase_27 AC 98 ms
71,552 KB
testcase_28 AC 98 ms
71,908 KB
testcase_29 AC 95 ms
71,820 KB
testcase_30 AC 96 ms
71,808 KB
testcase_31 AC 98 ms
71,892 KB
testcase_32 AC 134 ms
79,712 KB
testcase_33 AC 136 ms
79,760 KB
testcase_34 AC 112 ms
79,396 KB
testcase_35 AC 126 ms
79,476 KB
testcase_36 AC 124 ms
79,580 KB
testcase_37 AC 120 ms
79,716 KB
testcase_38 AC 122 ms
79,772 KB
testcase_39 AC 113 ms
79,616 KB
testcase_40 AC 133 ms
79,824 KB
testcase_41 AC 130 ms
79,764 KB
testcase_42 AC 124 ms
79,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd

N = int(input())
s = "x" + input().rstrip()
dp = [0]*(N+1)
dp[0] = 1
wa = "wa"
wo = "wo"
n = "n"
x = set(["wa","?a","w?","wo","w?", "?o", "??"])
for i in range(1, N+1):
    si = s[i]
    if si == "?" or si == n:
        dp[i] |= dp[i-1]
    if i >= 2:
        pre = s[i-1]
        w = pre + si
        if pre + si in x:
            dp[i] |= dp[i-2]
print('Yes') if dp[-1] else print('No')
0