結果

問題 No.2373 wa, wo, n
ユーザー とろちゃとろちゃ
提出日時 2023-07-07 21:54:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 1,332 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 87,188 KB
実行使用メモリ 91,680 KB
最終ジャッジ日時 2023-09-28 23:03:58
合計ジャッジ時間 6,668 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,440 KB
testcase_01 AC 93 ms
71,572 KB
testcase_02 AC 96 ms
71,888 KB
testcase_03 AC 95 ms
71,680 KB
testcase_04 AC 95 ms
71,664 KB
testcase_05 AC 95 ms
71,852 KB
testcase_06 AC 95 ms
71,748 KB
testcase_07 AC 95 ms
71,884 KB
testcase_08 AC 95 ms
71,604 KB
testcase_09 AC 94 ms
71,568 KB
testcase_10 AC 96 ms
71,852 KB
testcase_11 AC 95 ms
71,512 KB
testcase_12 AC 94 ms
71,604 KB
testcase_13 AC 94 ms
71,916 KB
testcase_14 AC 144 ms
86,116 KB
testcase_15 AC 115 ms
78,292 KB
testcase_16 AC 149 ms
88,400 KB
testcase_17 AC 120 ms
77,972 KB
testcase_18 AC 108 ms
77,460 KB
testcase_19 AC 100 ms
72,884 KB
testcase_20 AC 104 ms
73,216 KB
testcase_21 AC 103 ms
72,908 KB
testcase_22 AC 104 ms
72,812 KB
testcase_23 AC 105 ms
72,880 KB
testcase_24 AC 96 ms
71,752 KB
testcase_25 AC 97 ms
71,720 KB
testcase_26 AC 96 ms
71,448 KB
testcase_27 AC 98 ms
71,948 KB
testcase_28 AC 97 ms
71,852 KB
testcase_29 AC 95 ms
71,788 KB
testcase_30 AC 95 ms
71,908 KB
testcase_31 AC 95 ms
71,728 KB
testcase_32 AC 157 ms
91,680 KB
testcase_33 AC 105 ms
72,820 KB
testcase_34 AC 139 ms
88,524 KB
testcase_35 AC 105 ms
72,720 KB
testcase_36 AC 135 ms
87,016 KB
testcase_37 AC 122 ms
81,488 KB
testcase_38 AC 124 ms
82,472 KB
testcase_39 AC 114 ms
77,616 KB
testcase_40 AC 154 ms
90,544 KB
testcase_41 AC 153 ms
89,964 KB
testcase_42 AC 127 ms
82,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import pypyjit;pypyjit.set_param("max_unroll_recursion=-1")
# from bisect import *
from collections import *

# from heapq import *
# from itertools import *
# from math import *
# from datetime import *
# from decimal import *  # PyPyだと遅い
# from string import ascii_lowercase,ascii_uppercase
# import numpy as np
import sys
import os

# sys.setrecursionlimit(10**6) # PyPyだと遅い
INF = 10**18
MOD = 998244353
# MOD = 10**9 + 7
isFile = os.path.exists("input.txt")
File = open("input.txt", "r", encoding="utf-8") if isFile else sys.stdin


def input():
    return File.readline()[:-1]


# ///////////////////////////////////////////////////////////////////////////


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

for _ in range(INF):
    # print(S)
    if len(S) == 0:
        break
    if len(S) == 1:
        if S[0] not in ["n", "?"]:
            print("No")
            exit()
        else:
            break

    if S[0] == "n":
        S.popleft()
        continue
    elif S[0] == "w":
        S.popleft()
        if S[0] not in ["a", "o", "?"]:
            print("No")
            exit()
        else:
            S.popleft()
    else:
        if S[0] != "?":
            print("No")
            exit()
        else:
            S.popleft()
            if S[0] in ["a", "o"]:
                S.popleft()

print("Yes")
0