結果
問題 | No.2373 wa, wo, n |
ユーザー |
|
提出日時 | 2023-07-07 21:27:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 493 bytes |
コンパイル時間 | 835 ms |
コンパイル使用メモリ | 68,244 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-21 17:08:17 |
合計ジャッジ時間 | 1,872 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 39 |
ソースコード
#include<iostream>#include<vector>#include<cassert>using namespace std;int N;string S;bool dp[2<<17];bool f(int idx,char c){return S[idx]=='?'||S[idx]==c;}int main(){ios::sync_with_stdio(false);cin.tie(nullptr);cin>>N>>S;dp[0]=true;for(int i=0;i<N;i++)if(dp[i]){if(i+1<N){//waif(f(i,'w')&&f(i+1,'a'))dp[i+2]=true;}if(i+1<N){//woif(f(i,'w')&&f(i+1,'o'))dp[i+2]=true;}{if(f(i,'n'))dp[i+1]=true;}}cout<<(dp[N]?"Yes":"No")<<endl;}