結果

問題 No.2373 wa, wo, n
ユーザー ryusukeryusuke
提出日時 2023-07-09 17:43:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,046 bytes
コンパイル時間 693 ms
コンパイル使用メモリ 10,972 KB
実行使用メモリ 30,816 KB
最終ジャッジ日時 2023-09-30 21:12:10
合計ジャッジ時間 5,729 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,672 KB
testcase_01 AC 21 ms
8,572 KB
testcase_02 AC 18 ms
8,624 KB
testcase_03 AC 18 ms
8,508 KB
testcase_04 AC 19 ms
8,580 KB
testcase_05 AC 19 ms
8,580 KB
testcase_06 AC 18 ms
8,620 KB
testcase_07 AC 19 ms
8,552 KB
testcase_08 AC 18 ms
8,692 KB
testcase_09 AC 18 ms
8,676 KB
testcase_10 AC 18 ms
8,480 KB
testcase_11 AC 18 ms
8,660 KB
testcase_12 WA -
testcase_13 AC 19 ms
8,540 KB
testcase_14 AC 124 ms
26,336 KB
testcase_15 AC 35 ms
11,520 KB
testcase_16 AC 131 ms
28,088 KB
testcase_17 AC 47 ms
13,888 KB
testcase_18 AC 22 ms
9,212 KB
testcase_19 AC 58 ms
15,888 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 150 ms
28,680 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 18 ms
8,680 KB
testcase_27 AC 18 ms
8,660 KB
testcase_28 WA -
testcase_29 AC 18 ms
8,660 KB
testcase_30 AC 18 ms
8,576 KB
testcase_31 AC 19 ms
8,624 KB
testcase_32 AC 161 ms
30,632 KB
testcase_33 WA -
testcase_34 AC 173 ms
30,596 KB
testcase_35 AC 110 ms
30,700 KB
testcase_36 AC 150 ms
30,692 KB
testcase_37 AC 145 ms
30,736 KB
testcase_38 AC 152 ms
30,816 KB
testcase_39 AC 157 ms
30,620 KB
testcase_40 AC 154 ms
30,656 KB
testcase_41 AC 153 ms
30,736 KB
testcase_42 AC 163 ms
30,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# verification-helper: PROBLEM https://yukicoder.me/problems/no/2373

from collections import deque

def main() -> None:
    n = int(input())
    s = list(input())
    dp = [[False] * 4 for _ in range(n + 1)]
    # 0 := w, 1 := a, 2 := o, 3 := n, 4 := ?
    if s[0] == "w":
        dp[1][0] = True
    if s[0] == "n":
        dp[1][3] = True
    if s[0] == "?":
        dp[1][0] = True
        dp[1][3] = True
    
    for i in range(2, n + 1):
        if s[i - 1] == "a":
            dp[i][1] |= dp[i - 1][0]
        elif s[i - 1] == "o":
            dp[i][2] |= dp[i - 1][0]
        elif s[i - 1] == "w":
            dp[i][0] = True
        elif s[i - 1] == "n":
            dp[i][3] = True
        elif s[i - 1] == "?":
            if dp[i - 1][0]:
                dp[i][1] = True
                dp[i][2] = True
            else:
                dp[i][3] = True
        else:
            exit(print("No"))

    #print(*dp, sep="\n")
    print("Yes") if dp[n][1] or dp[n][2] or dp[n][3] else print("No")


if __name__ == "__main__":
    main()
0