結果
問題 |
No.2373 wa, wo, n
|
ユーザー |
|
提出日時 | 2023-07-07 23:32:42 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 89 ms / 2,000 ms |
コード長 | 502 bytes |
コンパイル時間 | 385 ms |
コンパイル使用メモリ | 82,348 KB |
実行使用メモリ | 78,120 KB |
最終ジャッジ日時 | 2024-07-21 19:56:51 |
合計ジャッジ時間 | 3,875 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 39 |
ソースコード
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 break if ok: # print(i,x,i+len(x)) dp[i+len(x)] = 1 # print(dp) print("Yes" if dp[-1] else "No")