結果
問題 |
No.2373 wa, wo, n
|
ユーザー |
![]() |
提出日時 | 2023-07-07 22:06:55 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 718 bytes |
コンパイル時間 | 208 ms |
コンパイル使用メモリ | 82,136 KB |
実行使用メモリ | 76,036 KB |
最終ジャッジ日時 | 2024-07-21 18:09:03 |
合計ジャッジ時間 | 3,597 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 38 WA * 1 |
ソースコード
N = int(input()) S = input() for c in S: if c not in 'waon?': exit(print('No')) T = S.replace('n','').replace('wa','').replace('wo','') if T=='': exit(print('Yes')) T = T.replace('o','a') assert all(c in 'wa?' for c in T) if len(T) == 1: exit(print('Yes' if T=='?' else 'No')) buf = '' for c in T: if c == 'w': if buf=='w' or buf=='a': exit(print('No')) buf = 'w' elif c == 'a': if buf=='a' or buf=='': exit(print('No')) buf = '' else: if buf=='w': buf = '' elif buf=='a': assert False else: buf = '?' if buf=='?' or buf == '': print('Yes') else: print('No')