結果

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

ソースコード

diff #

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


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

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