結果

問題 No.2373 wa, wo, n
ユーザー aaaaaaaaaa2230
提出日時 2023-07-07 22:18:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 446 bytes
コンパイル時間 232 ms
コンパイル使用メモリ 82,300 KB
実行使用メモリ 77,928 KB
最終ジャッジ日時 2024-07-21 18:23:51
合計ジャッジ時間 3,566 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 37 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
S = input()
dp = [0]*(n+1)
dp[0] = 1
l = ["wa","wo","n"]

for i in range(n):
    if dp[i] == 0:
        continue

    for x in l:
        if len(x) + i > n:
            continue
        ok = 1
        for j in range(len(x)):
            if x[j] == S[i+j] or S[i+j] == "?":
                ok = 1
            else:
                ok = 0
        if ok:
            dp[i+len(x)] = 1
    # print(dp)
print("Yes" if dp[-1] else "No")
0