結果
| 問題 | No.2373 wa, wo, n |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-21 11:27:05 |
| 言語 | Python3 (3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 631 ms / 2,000 ms |
| + 236µs | |
| コード長 | 332 bytes |
| 記録 | |
| コンパイル時間 | 290 ms |
| コンパイル使用メモリ | 21,212 KB |
| 実行使用メモリ | 17,196 KB |
| 最終ジャッジ日時 | 2026-09-01 16:06:28 |
| 合計ジャッジ時間 | 10,898 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 39 |
ソースコード
n = int(input())
s = input()
def match(s, p):
for s, p in zip(s, p):
if s != p and s != '?':
return False
return True
dp = [False] * (n + 1)
dp[0] = True
for i in range(n):
if dp[i]:
for p in ["wa", "wo", "n"]:
if i + len(p) <= n and match(s[i: i + len(p)], p):
dp[i + len(p)] = True
print("Yes" if dp[n] else "No")