結果
| 問題 |
No.2373 wa, wo, n
|
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2025-03-04 02:52:34 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 80 ms / 2,000 ms |
| コード長 | 682 bytes |
| コンパイル時間 | 572 ms |
| コンパイル使用メモリ | 82,616 KB |
| 実行使用メモリ | 76,192 KB |
| 最終ジャッジ日時 | 2025-03-04 02:52:38 |
| 合計ジャッジ時間 | 4,547 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 39 |
ソースコード
N = int(input())
S = input()
for s in S:
if s not in ["w", "a", "o", "n", "?"]:
exit(print("No"))
idx = 0
while idx < len(S):
if S[idx] == "n":
idx += 1
elif S[idx] == "w":
if idx+1 == len(S):
print("No")
break
elif S[idx+1] in ["a", "o", "?"]:
idx += 2
else:
print("No")
break
elif S[idx] == "?":
if idx+1 == len(S):
idx += 1
elif S[idx+1] in ["w", "n"]:
idx += 1
elif S[idx+1] in ["a", "o"]:
idx += 2
else:
idx += 1
else:
print("No")
break
else:
print("Yes")
detteiuu